Commit 071996af by Ting PAN

Apply new pixel means

1 parent b1c4e901
......@@ -513,10 +513,8 @@ __C.USE_NCCL = True
# Hosts for Inter-Machine communication
__C.HOSTS = []
# Pixel mean values (BGR order) as a (1, 1, 3) array
# We use the same pixel mean for all networks even though it's not exactly what
# they were trained with
__C.PIXEL_MEANS = np.array([[[102.9801, 115.9465, 122.7717]]])
# Pixel mean values (BGR order)
__C.PIXEL_MEANS = [102., 115., 122.]
# Default weights on (dx, dy, dw, dh) for normalizing bbox regression targets
# These are empirically chosen to approximately lead to unit variance targets
......
......@@ -35,7 +35,7 @@ class Bootstarp(torch.nn.Module):
'arguments': {
'dtype': self.dtype,
'data_format': 'NCHW',
'mean_values': [102.9801, 115.9465, 122.7717],
'mean_values': cfg.PIXEL_MEANS,
}
}
......
......@@ -109,8 +109,8 @@ class Detector(torch.nn.Module):
# 1) NHWC => NCHW
# 2) Uint8 => Float32 or Float16
# 3) Mean subtraction
processed_data = self.bootstarp(inputs['data'])
features = self.body(processed_data)
image_data = self.bootstarp(inputs['data'])
features = self.body(image_data)
# 2. Apply the FPN to enhance features if necessary
if hasattr(self, 'fpn'):
......
......@@ -43,7 +43,7 @@ class RetinaNet(torch.nn.Module):
self.cls_score = conv3x3(dim_in, self.C * A, bias=True)
self.bbox_pred = conv3x3(dim_in, 4 * A, bias=True)
self.cls_prob = torch.nn.Sigmoid(inplace=True)
self.relu = torch.nn.ELU(inplace=True)
self.relu = torch.nn.ReLU(inplace=True)
self.decoder = RetinaNetDecoder()
########################################
......
......@@ -44,7 +44,7 @@ class Expander(object):
new_im = np.empty((expand_h, expand_w, 3), dtype=np.uint8)
new_im[:] = cfg.PIXEL_MEANS
new_im[h_off: h_off + im_h, w_off: w_off + im_w, :] = im
new_im[h_off : h_off + im_h, w_off : w_off + im_w, :] = im
if gt_boxes is not None:
ex_gt_boxes = gt_boxes.astype(gt_boxes.dtype, copy=True)
......
......@@ -41,8 +41,8 @@ def im_list_to_blob(ims):
blob = np.empty(unify_shape, dtype=np.uint8)
blob[:] = cfg.PIXEL_MEANS
for idx, im in enumerate(ims):
blob[idx, 0:im.shape[0], 0:im.shape[1], :] = im
for i, im in enumerate(ims):
blob[i, :im.shape[0], :im.shape[1], :] = im
return blob
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!