Пример #1
0
 def prepare_image(self, image):
     was_fixed_point = not image.is_floating_point()
     image = torch.empty(image.shape, device='cpu', dtype=torch.float32).copy_(image)
     if was_fixed_point:
         image /= 255.0
     if image.shape[-2:] != (256, 256):
         image = resize(image, 256, 256)
     image = color_normalize(image, Mpii.RGB_MEAN, Mpii.RGB_STDDEV)
     return image
 def prepare_image(self, image):
     was_fixed_point = not image.is_floating_point()
     image = torch.empty(image.shape, device='cpu',
                         dtype=torch.float32).copy_(image)
     if was_fixed_point:
         image /= 255.0
     if image.shape[-2:] != (256, 256):
         image = resize(image, 256, 256)
     image = color_normalize(image, self.data_info.rgb_mean,
                             self.data_info.rgb_stddev)
     return image
Пример #3
0
def example_input(man_running_image):
    mean = torch.as_tensor([0.4404, 0.4440, 0.4327])
    std = torch.as_tensor([0.2458, 0.2410, 0.2468])
    image = resize(man_running_image, 256, 256)
    image = color_normalize(image, mean, std)
    return image.unsqueeze(0)