diff --git a/deeplabcut/pose_estimation_pytorch/data/dataset.py b/deeplabcut/pose_estimation_pytorch/data/dataset.py index cbb9b9726a..c2e0da9891 100644 --- a/deeplabcut/pose_estimation_pytorch/data/dataset.py +++ b/deeplabcut/pose_estimation_pytorch/data/dataset.py @@ -250,7 +250,7 @@ def _prepare_final_annotation_dict( # we use ..., :3 to pass the visibility flag along return { - "keypoints": pad_to_length(keypoints[..., :3], num_animals, -1).astype( + "keypoints": pad_to_length(keypoints[..., :3], num_animals, 0).astype( np.single ), "keypoints_unique": keypoints_unique[..., :3].astype(np.single), diff --git a/deeplabcut/pose_estimation_pytorch/data/transforms.py b/deeplabcut/pose_estimation_pytorch/data/transforms.py index 6e5bd0d1e9..6d14870bd7 100644 --- a/deeplabcut/pose_estimation_pytorch/data/transforms.py +++ b/deeplabcut/pose_estimation_pytorch/data/transforms.py @@ -78,7 +78,7 @@ def build_transforms(augmentations: dict) -> A.BaseCompose: if rotation is not None: rotation = (-rotation, rotation) if translation is not None: - translation = (0, translation) + translation = (-translation, translation) transforms.append( A.Affine( @@ -281,6 +281,8 @@ def get_params_dependent_on_targets(self, params: dict[str, Any]) -> dict[str, A sampling = self.crop_sampling if self.crop_sampling == "hybrid": sampling = np.random.choice(["uniform", "density"]) + if len(kpts) == 0: + sampling = "uniform" if sampling == "uniform": center = np.random.random(2) else: @@ -310,7 +312,7 @@ def apply_to_keypoints( self, keypoints, **params, - ) -> list[float]: + ) -> list[tuple[float]]: keypoints = super().apply_to_keypoints(keypoints, **params) new_keypoints = [] for kp in keypoints: