コード例 #1
0
 def _transform_image(self, image_path, areas, style, cloths):
     segmentation_mask, _ = self._segmentation_model.predict(image_path)
     # transformed_image = self._style_transformer.transform(image=image, style=style)  FIXME
     image = cv2.imread(image_path)
     assert image is not None, image_path
     image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
     # return image, None
     if not cloths:
         transformed_image = self._motion_blur(image, ksize=45)
     else:
         transformed_image = shift_hsv(image, 100, 50, 50)
     return self._morph_transforms(initial_image=image,
                                   transformed_image=transformed_image,
                                   segmentation_mask=segmentation_mask,
                                   areas=areas)
コード例 #2
0
 def apply(self, image, hue_shift=0, sat_shift=0, val_shift=0, label = None, **params):
     print("apply")
     if label is not None:
         print('thread aug')
         image = np.array(image)
     
         output = image.copy()
         hsv = image.copy()
         hsv = F.shift_hsv(hsv, hue_shift, sat_shift, val_shift)
     
         thread = np.where(label==self.thread_idx)
         output[thread] = hsv[thread]
         
         return output
     else:
         print('thread aug failed')
         return image
コード例 #3
0
 def albumentations(self, img):
     return albumentations.shift_hsv(img,
                                     hue_shift=20,
                                     sat_shift=20,
                                     val_shift=20)
コード例 #4
0
def test_shift_hsv_gray(img):
    F.shift_hsv(img, 0.5, 0.5, 0.5)
コード例 #5
0
 def albumentations(self, img):
     return albumentations.shift_hsv(img, hue_shift=20, sat_shift=20, val_shift=20)