Skip to content

Commit

Permalink
🐛 Delay import of mmpose (#1866)
Browse files Browse the repository at this point in the history
  • Loading branch information
huchenlei authored Aug 4, 2023
1 parent 397f54b commit 7c695c9
Showing 1 changed file with 4 additions and 1 deletion.
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

0 comments on commit 7c695c9

Please sign in to comment.