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

🐛 Delay import of mmpose #1866

Merged
merged 1 commit into from
Aug 4, 2023
Merged
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
5 changes: 4 additions & 1 deletion annotator/openpose/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
from .body import Body, BodyResult, Keypoint
from .hand import Hand
from .face import Face
from .wholebody import Wholebody # DW Pose
from .types import PoseResult, HandResult, FaceResult
from modules import devices
from annotator.annotator_path import models_path
Expand Down Expand Up @@ -201,6 +200,8 @@ def load_model(self):
self.face_estimation = Face(face_modelpath)

def load_dw_model(self):
from .wholebody import Wholebody # DW Pose

dw_modelpath = os.path.join(self.model_dir, "dw-ll_ucoco_384.pth")
if not os.path.exists(dw_modelpath):
from basicsr.utils.download_util import load_file_from_url
Expand Down Expand Up @@ -323,6 +324,8 @@ def detect_poses_dw(self, oriImg) -> List[PoseResult]:
Returns:
List[PoseResult]: A list of PoseResult objects containing the detected poses.
"""
from .wholebody import Wholebody # DW Pose

if self.dw_pose_estimation is None:
self.load_dw_model()

Expand Down