Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/sg 000 fix predict in pose estimation #1358

Merged
merged 19 commits into from
Aug 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from super_gradients.common.registry.registry import register_model
from super_gradients.common.object_names import Models
from super_gradients.common.abstractions.abstract_logger import get_logger
from super_gradients.module_interfaces import HasPredict
from super_gradients.training.utils.predict import ImagesPoseEstimationPrediction
from super_gradients.training.models.sg_module import SgModule
from super_gradients.training.models.arch_params_factory import get_arch_params
Expand Down Expand Up @@ -294,7 +295,7 @@ def forward(self, x):


@register_model(Models.DEKR_CUSTOM)
class DEKRPoseEstimationModel(SgModule):
class DEKRPoseEstimationModel(SgModule, HasPredict):
"""
Implementation of HRNet model from DEKR paper (https://arxiv.org/abs/2104.02300).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def get_equivalent_preprocessing(self) -> List:
]

def __repr__(self):
return self.__class__.__name__ + f"(permutation={self.permutation})"
return self.__class__.__name__ + "()"


@register_transform(Transforms.KeypointsImageStandardize)
Expand Down
16 changes: 16 additions & 0 deletions tests/unit_tests/test_predict.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,22 @@ def test_classification_models(self):
predictions.show()
predictions.save(output_folder=tmp_dirname)

def test_pose_estimation_models(self):
model = models.get(Models.DEKR_W32_NO_DC, pretrained_weights="coco_pose")

with tempfile.TemporaryDirectory() as tmp_dirname:
predictions = model.predict(self.images)
predictions.show()
predictions.save(output_folder=tmp_dirname)

def test_detection_models(self):
model = models.get(Models.YOLO_NAS_S, pretrained_weights="coco")

with tempfile.TemporaryDirectory() as tmp_dirname:
predictions = model.predict(self.images)
predictions.show()
predictions.save(output_folder=tmp_dirname)


if __name__ == "__main__":
unittest.main()