diff --git a/.gitignore b/.gitignore index 9dac678..166446e 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ debug.py build dist torchlm.egg-info -*.sh \ No newline at end of file +*.sh +./data \ No newline at end of file diff --git a/setup.py b/setup.py index df96ea3..854c71e 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ def get_long_description(): - description = (PATH_ROOT / "docs/README.md").read_text(encoding="utf-8") + description = (PATH_ROOT / "README.md").read_text(encoding="utf-8") # replace relative repository path to absolute link to the release static_url = f"https://github.com/DefTruth/torchlm/blob/main/" description = description.replace("docs/res/", f"{static_url}/docs/res/") @@ -13,7 +13,7 @@ def get_long_description(): setuptools.setup( name="torchlm", - version="0.1.2", + version="0.1.3", author="DefTruth", author_email="qyjdef@163.com", description="A PyTorch landmarks-only library with 100+ data augmentations, " diff --git a/torchlm/__init__.py b/torchlm/__init__.py index 02b9111..0fefdd1 100644 --- a/torchlm/__init__.py +++ b/torchlm/__init__.py @@ -1,5 +1,5 @@ # Versions -__version__ = '0.1.2' +__version__ = '0.1.3' # Transforms Module: 100+ transforms available, can bind torchvision and # albumentations into torchlm pipeline with autodtype wrapper. from .transfroms import * diff --git a/torchlm/data/_300w.py b/torchlm/data/_300w.py new file mode 100644 index 0000000..e69de29 diff --git a/torchlm/data/_aflw.py b/torchlm/data/_aflw.py new file mode 100644 index 0000000..e69de29 diff --git a/torchlm/data/_cofw.py b/torchlm/data/_cofw.py new file mode 100644 index 0000000..e69de29 diff --git a/torchlm/data/_wflw.py b/torchlm/data/_wflw.py new file mode 100644 index 0000000..e69de29 diff --git a/torchlm/transfroms/transforms.py b/torchlm/transfroms/transforms.py index 8d1b5a9..133a95d 100644 --- a/torchlm/transfroms/transforms.py +++ b/torchlm/transfroms/transforms.py @@ -807,6 +807,7 @@ def __call__( self.scale_y = scale_y if len(new_landmarks) != num_landmarks: + self.flag = False raise F.Error('LandmarksResize: {0} input landmarks, but got {1} output ' 'landmarks'.format(num_landmarks, len(new_landmarks))) @@ -957,6 +958,7 @@ def __call__( self.scale_y = (1 / scale_factor_y) if len(new_landmarks) != num_landmarks: + self.flag = False raise F.Error('LandmarksAlign: {0} input landmarks, but got {1} output ' 'landmarks'.format(num_landmarks, len(new_landmarks))) @@ -1038,6 +1040,7 @@ def __call__( self.scale_y = (1 / scale_factor_y) if len(new_landmarks) != num_landmarks: + self.flag = False raise F.Error('LandmarksAlign: {0} input landmarks, but got {1} output ' 'landmarks'.format(num_landmarks, len(new_landmarks))) @@ -1114,6 +1117,7 @@ def __call__( ly_max = np.max(new_landmarks[:, 1]) if any((lx_min < 0., lx_max > crop_width, ly_min < 0., ly_max > crop_height)): + self.flag = False return img.astype(np.uint8), landmarks new_img = img[y1:y2, x1:x2, :].copy() @@ -1255,6 +1259,7 @@ def __call__( self.scale_y = resize_scale_y if len(new_landmarks) != num_landmarks: + self.flag = False raise F.Error('LandmarksRandomScale: {0} input landmarks, but got {1} output ' 'landmarks'.format(num_landmarks, len(new_landmarks))) @@ -1344,6 +1349,7 @@ def __call__( img_h=new_img.shape[0]) if len(new_landmarks) != num_landmarks: + self.flag = False raise F.Error('LandmarksRandomTranslate: {0} input landmarks, but got {1} ' 'output landmarks'.format(num_landmarks, len(new_landmarks))) @@ -1430,6 +1436,7 @@ def __call__( self.scale_y = (1 / scale_factor_y) if len(new_landmarks) != num_landmarks: + self.flag = False raise F.Error( 'LandmarksRandomRotate: {0} input landmarks, but got {1} output ' 'landmarks'.format(num_landmarks, len(new_landmarks)) @@ -1512,6 +1519,7 @@ def __call__( self.scale_y = 1. if len(new_landmarks) != num_landmarks: + self.flag = False raise F.Error( 'LandmarksRandomShear: {0} input landmarks, but got {1} output ' 'landmarks'.format(num_landmarks, len(new_landmarks)) @@ -1848,7 +1856,7 @@ def __call__( patch = F.select_patch(patch_h=new_patch_h, patch_w=new_patch_w, patches_paths=self._patches_paths) if patch is None: - self.flag = True + self.flag = False img.astype(np.uint8), landmarks.astype(np.float32) new_img, patch_corner = F.apply_patch(img=img, patch=patch) @@ -1911,7 +1919,7 @@ def __call__( patch = F.select_patch(patch_h=new_patch_h, patch_w=new_patch_w, patches_paths=self._patches_paths) if patch is None: - self.flag = True + self.flag = False img.astype(np.uint8), landmarks.astype(np.float32) alpha = np.random.uniform(0.1, self._alpha) @@ -1961,7 +1969,7 @@ def __call__( ) if background is None: - self.flag = True + self.flag = False return img.astype(np.uint8), landmarks.astype(np.float32) new_img = F.apply_background_with_alpha(img=img, background=background, alpha=alpha) @@ -2008,7 +2016,7 @@ def __call__( ) if background is None: - self.flag = True + self.flag = False return img.astype(np.uint8), landmarks.astype(np.float32) new_img = F.apply_background(img=img, background=background)