Skip to content

Commit ba5553a

Browse files
committed
small edit to make multi-threading easier
1 parent a301eb9 commit ba5553a

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ pip install .
120120

121121
#### Full install
122122

123-
> Only needed if you want to run inverse kinematics (`--do_ik True`).
123+
> **N.B.:** Only needed if you want to run inverse kinematics (`--do_ik True`).\
124+
> **N.B.:** If you already have a Pose2Sim conda environment, you can skip this step. Just run `conda activate Pose2Sim` and `pip install sports2d`.
124125
125126
- Install Anaconda or [Miniconda](https://docs.conda.io/en/latest/miniconda.html):\
126127
Open an Anaconda prompt and create a virtual environment:

Sports2D/process.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
from matplotlib.widgets import Slider, Button
7777
from matplotlib import patheffects
7878

79-
from rtmlib import PoseTracker, BodyWithFeet, Wholebody, Body, Custom
79+
from rtmlib import PoseTracker, BodyWithFeet, Wholebody, Body, Hand, Custom
8080
from deep_sort_realtime.deepsort_tracker import DeepSort
8181

8282
from Sports2D.Utilities import filter
@@ -1524,9 +1524,14 @@ def process_fun(config_dict, video_file, time_range, frame_rate, result_dir):
15241524
# Set up pose tracker
15251525
try:
15261526
pose_tracker = setup_pose_tracker(ModelClass, det_frequency, mode, False, backend, device)
1527-
except:
1528-
logging.error('Error: Pose estimation failed. Check in Config.toml that pose_model and mode are valid.')
1529-
raise ValueError('Error: Pose estimation failed. Check in Config.toml that pose_model and mode are valid.')
1527+
except: # for multi-threading
1528+
try:
1529+
import time
1530+
time.sleep(3)
1531+
pose_tracker = setup_pose_tracker(ModelClass, det_frequency, mode, False, backend, device)
1532+
except:
1533+
logging.error('Error: Pose estimation failed. Check in Config.toml that pose_model and mode are valid.')
1534+
raise ValueError('Error: Pose estimation failed. Check in Config.toml that pose_model and mode are valid.')
15301535

15311536
if tracking_mode not in ['deepsort', 'sports2d']:
15321537
logging.warning(f"Tracking mode {tracking_mode} not recognized. Using sports2d method.")

0 commit comments

Comments
 (0)