@@ -807,6 +807,7 @@ def __call__(
807807 self .scale_y = scale_y
808808
809809 if len (new_landmarks ) != num_landmarks :
810+ self .flag = False
810811 raise F .Error ('LandmarksResize: {0} input landmarks, but got {1} output '
811812 'landmarks' .format (num_landmarks , len (new_landmarks )))
812813
@@ -957,6 +958,7 @@ def __call__(
957958 self .scale_y = (1 / scale_factor_y )
958959
959960 if len (new_landmarks ) != num_landmarks :
961+ self .flag = False
960962 raise F .Error ('LandmarksAlign: {0} input landmarks, but got {1} output '
961963 'landmarks' .format (num_landmarks , len (new_landmarks )))
962964
@@ -1038,6 +1040,7 @@ def __call__(
10381040 self .scale_y = (1 / scale_factor_y )
10391041
10401042 if len (new_landmarks ) != num_landmarks :
1043+ self .flag = False
10411044 raise F .Error ('LandmarksAlign: {0} input landmarks, but got {1} output '
10421045 'landmarks' .format (num_landmarks , len (new_landmarks )))
10431046
@@ -1114,6 +1117,7 @@ def __call__(
11141117 ly_max = np .max (new_landmarks [:, 1 ])
11151118
11161119 if any ((lx_min < 0. , lx_max > crop_width , ly_min < 0. , ly_max > crop_height )):
1120+ self .flag = False
11171121 return img .astype (np .uint8 ), landmarks
11181122
11191123 new_img = img [y1 :y2 , x1 :x2 , :].copy ()
@@ -1255,6 +1259,7 @@ def __call__(
12551259 self .scale_y = resize_scale_y
12561260
12571261 if len (new_landmarks ) != num_landmarks :
1262+ self .flag = False
12581263 raise F .Error ('LandmarksRandomScale: {0} input landmarks, but got {1} output '
12591264 'landmarks' .format (num_landmarks , len (new_landmarks )))
12601265
@@ -1344,6 +1349,7 @@ def __call__(
13441349 img_h = new_img .shape [0 ])
13451350
13461351 if len (new_landmarks ) != num_landmarks :
1352+ self .flag = False
13471353 raise F .Error ('LandmarksRandomTranslate: {0} input landmarks, but got {1} '
13481354 'output landmarks' .format (num_landmarks , len (new_landmarks )))
13491355
@@ -1430,6 +1436,7 @@ def __call__(
14301436 self .scale_y = (1 / scale_factor_y )
14311437
14321438 if len (new_landmarks ) != num_landmarks :
1439+ self .flag = False
14331440 raise F .Error (
14341441 'LandmarksRandomRotate: {0} input landmarks, but got {1} output '
14351442 'landmarks' .format (num_landmarks , len (new_landmarks ))
@@ -1512,6 +1519,7 @@ def __call__(
15121519 self .scale_y = 1.
15131520
15141521 if len (new_landmarks ) != num_landmarks :
1522+ self .flag = False
15151523 raise F .Error (
15161524 'LandmarksRandomShear: {0} input landmarks, but got {1} output '
15171525 'landmarks' .format (num_landmarks , len (new_landmarks ))
@@ -1848,7 +1856,7 @@ def __call__(
18481856 patch = F .select_patch (patch_h = new_patch_h , patch_w = new_patch_w ,
18491857 patches_paths = self ._patches_paths )
18501858 if patch is None :
1851- self .flag = True
1859+ self .flag = False
18521860 img .astype (np .uint8 ), landmarks .astype (np .float32 )
18531861
18541862 new_img , patch_corner = F .apply_patch (img = img , patch = patch )
@@ -1911,7 +1919,7 @@ def __call__(
19111919 patch = F .select_patch (patch_h = new_patch_h , patch_w = new_patch_w ,
19121920 patches_paths = self ._patches_paths )
19131921 if patch is None :
1914- self .flag = True
1922+ self .flag = False
19151923 img .astype (np .uint8 ), landmarks .astype (np .float32 )
19161924
19171925 alpha = np .random .uniform (0.1 , self ._alpha )
@@ -1961,7 +1969,7 @@ def __call__(
19611969 )
19621970
19631971 if background is None :
1964- self .flag = True
1972+ self .flag = False
19651973 return img .astype (np .uint8 ), landmarks .astype (np .float32 )
19661974
19671975 new_img = F .apply_background_with_alpha (img = img , background = background , alpha = alpha )
@@ -2008,7 +2016,7 @@ def __call__(
20082016 )
20092017
20102018 if background is None :
2011- self .flag = True
2019+ self .flag = False
20122020 return img .astype (np .uint8 ), landmarks .astype (np .float32 )
20132021
20142022 new_img = F .apply_background (img = img , background = background )
0 commit comments