Beispiel #1
0
    def pre_process(self, images):

        mean = config.image_mean.reshape(1, 3, 1, 1).astype(np.float32)
        std = config.image_std.reshape(1, 3, 1, 1).astype(np.float32)
        mean = mge.tensor(mean).to(images.device)
        std = mge.tensor(std).to(images.device)
        normed_images = (images - mean) / std
        normed_images = get_padded_tensor(normed_images, 64)
        return normed_images
Beispiel #2
0
 def forward(self, inputs):
     images = inputs['image']
     im_info = inputs['im_info']
     gt_boxes = inputs['gt_boxes']
     # process the images
     normed_images = (images - config.image_mean[None, :, None, None]
                      ) / config.image_std[None, :, None, None]
     normed_images = get_padded_tensor(normed_images, 64)
     if self.training:
         return self._forward_train(normed_images, im_info, gt_boxes)
     else:
         return self._forward_test(normed_images, im_info)