-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'philip/flesh_out_mediapipe_model_info' of https://githu…
…b.com/freemocap/skellytracker into philip/flesh_out_mediapipe_model_info
- Loading branch information
Showing
43 changed files
with
1,891 additions
and
266 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Linting Ruff | ||
|
||
on: | ||
pull_request: | ||
branches: [ main ] | ||
paths: | ||
- 'skellytracker/**' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python 3.x | ||
uses: actions/setup-python@v4 | ||
with: | ||
# Semantic version range syntax or exact version of a Python version | ||
python-version: '3.9' | ||
# Optional - x64 or x86 architecture, defaults to x64 | ||
architecture: 'x64' | ||
cache: 'pip' | ||
- name: Install dependencies | ||
run: | | ||
pip install "-e.[dev]" | ||
- name: Run linting | ||
run: | | ||
ruff check skellytracker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: SkellyTracker Tests | ||
|
||
on: | ||
pull_request: | ||
branches: [ main ] | ||
paths: | ||
- 'skellytracker/**' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: System Info | ||
run: | | ||
uname -a || true | ||
lsb_release -a || true | ||
gcc --version || true | ||
env | ||
- name: Set up Python 3.x | ||
uses: actions/setup-python@v4 | ||
with: | ||
# Semantic version range syntax or exact version of a Python version | ||
python-version: '3.9' | ||
# Optional - x64 or x86 architecture, defaults to x64 | ||
architecture: 'x64' | ||
cache: 'pip' | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install "-e.[all]" | ||
- name: Fix OpenCV conflict | ||
run: | | ||
pip uninstall -y opencv-python opencv-contrib-python | ||
pip install opencv-contrib-python==4.8.1.78 | ||
- name: Set PYTHONPATH | ||
run: echo "PYTHONPATH=$PYTHONPATH:$(pwd)/skellytracker" >> $GITHUB_ENV | ||
- name: Run Tests with Pytest | ||
run: | | ||
pip install pytest | ||
pytest skellytracker/tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,51 @@ | ||
import cv2 | ||
from pathlib import Path | ||
|
||
from skellytracker.trackers.bright_point_tracker.brightest_point_tracker import BrightestPointTracker | ||
from skellytracker.trackers.bright_point_tracker.brightest_point_tracker import ( | ||
BrightestPointTracker, | ||
) | ||
from skellytracker.trackers.charuco_tracker.charuco_tracker import CharucoTracker | ||
from skellytracker.trackers.mediapipe_tracker.mediapipe_holistic_tracker import MediapipeHolisticTracker | ||
from skellytracker.trackers.yolo_tracker.yolo_tracker import YOLOPoseTracker | ||
|
||
try: | ||
from skellytracker.trackers.mediapipe_tracker.mediapipe_holistic_tracker import ( | ||
MediapipeHolisticTracker, | ||
) | ||
except ModuleNotFoundError: | ||
print("\n\nTo use mediapipe_holistic_tracker, install skellytracker[mediapipe]\n\n") | ||
try: | ||
from skellytracker.trackers.yolo_tracker.yolo_tracker import YOLOPoseTracker | ||
except ModuleNotFoundError: | ||
print("\n\nTo use yolo_tracker, install skellytracker[yolo]\n\n") | ||
|
||
|
||
if __name__ == "__main__": | ||
demo_tracker = "brightest_point_tracker" | ||
image_path = Path("/Path/To/Your/Image.jpg") | ||
|
||
if demo_tracker == "brightest_point_tracker": | ||
BrightestPointTracker().image_demo(image_path=image_path) | ||
BrightestPointTracker(num_points=2).image_demo(image_path=image_path) | ||
|
||
elif demo_tracker == "charuco_tracker": | ||
CharucoTracker(squaresX=7, | ||
squaresY=5, | ||
dictionary=cv2.aruco.getPredefinedDictionary(cv2.aruco.DICT_4X4_250)).image_demo(image_path=image_path) | ||
charuco_squares_x = 7 | ||
charuco_squares_y = 5 | ||
number_of_charuco_markers = (charuco_squares_x - 1) * (charuco_squares_y - 1) | ||
charuco_ids = [str(index) for index in range(number_of_charuco_markers)] | ||
|
||
CharucoTracker( | ||
tracked_object_names=charuco_ids, | ||
squares_x=charuco_squares_x, | ||
squares_y=charuco_squares_y, | ||
dictionary=cv2.aruco.getPredefinedDictionary(cv2.aruco.DICT_4X4_250), | ||
).image_demo(image_path=image_path) | ||
|
||
elif demo_tracker == "mediapipe_holistic_tracker": | ||
MediapipeHolisticTracker(model_complexity=2, | ||
min_detection_confidence=0.5, | ||
min_tracking_confidence=0.5, | ||
static_image_mode=False, | ||
smooth_landmarks=True).image_demo(image_path=image_path) | ||
MediapipeHolisticTracker( | ||
model_complexity=2, | ||
min_detection_confidence=0.5, | ||
min_tracking_confidence=0.5, | ||
static_image_mode=False, | ||
smooth_landmarks=True, | ||
).image_demo(image_path=image_path) | ||
|
||
elif demo_tracker == "yolo_tracker": | ||
YOLOPoseTracker(model_size="high_res").image_demo(image_path=image_path) | ||
YOLOPoseTracker(model_size="high_res").image_demo(image_path=image_path) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.