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

Fix ffmpeg install on macos #329

Merged
merged 26 commits into from
May 17, 2024
Merged

Fix ffmpeg install on macos #329

merged 26 commits into from
May 17, 2024

Conversation

ejm714
Copy link
Collaborator

@ejm714 ejm714 commented May 14, 2024

Closes #315
Closes #326
Closes #327
Closes #328

Copy link

netlify bot commented May 14, 2024

Deploy Preview for silly-keller-664934 ready!

Name Link
🔨 Latest commit 9cee50a
🔍 Latest deploy log https://app.netlify.com/sites/silly-keller-664934/deploys/6646be1d6337f20008aa5130
😎 Deploy Preview https://deploy-preview-329--silly-keller-664934.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Contributor

github-actions bot commented May 14, 2024

@ejm714 ejm714 force-pushed the fix-ffmpeg-install-on-macos branch from 9e9216b to 9040888 Compare May 15, 2024 05:28
Copy link

codecov bot commented May 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.4%. Comparing base (70e79f2) to head (9cee50a).

Additional details and impacted files
@@          Coverage Diff           @@
##           master    #329   +/-   ##
======================================
  Coverage    87.4%   87.4%           
======================================
  Files          26      26           
  Lines        2191    2191           
======================================
  Hits         1915    1915           
  Misses        276     276           

@@ -438,7 +438,7 @@ def test_megadetector_lite_yolox_dog(tmp_path):
[
"ffmpeg",
"-r",
"60",
"30",
Copy link
Collaborator Author

@ejm714 ejm714 May 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like something funky was happening in the creation of the video from individual images (which is not our standard workflow, the goal was just to create a video with known frames with objects). We separately test MegadetectorLite just on the stack of 10 frames and get the right detections out.

def test_detect_video(mdlite, dog):
total_frames = 10
object_frame_indices = [0, 3, 4, 6]
video = np.zeros([total_frames] + list(dog.size[::-1]) + [3], dtype=np.uint8)
video[object_frame_indices] = np.array(dog)
mdlite = MegadetectorLiteYoloX()
detections = mdlite.detect_video(video)
# Check that we detected the correct number of frames
assert sum(len(score) > 0 for _, score in detections) == len(object_frame_indices)
for frame_index, (frame, (_, score)) in enumerate(zip(video, detections)):
if len(score) > 0:
# Frame index is in intended frame indices
assert frame_index in object_frame_indices
# No blank frames were selected
assert not (frame == np.zeros(frame.shape, dtype=np.uint8)).all()

I can't explain why but any frame rate other than 60 makes this test pass 🤷‍♀️ I use 30 here since that's typically what we see in videos coming in

@@ -458,7 +458,9 @@ def test_megadetector_lite_yolox_dog(tmp_path):
"-y",
]
)
frames = load_video_frames(tmp_path / "dog.mp4", megadetector_lite_config={"confidence": 0.25})
frames = load_video_frames(
tmp_path / "dog.mp4", megadetector_lite_config=MegadetectorLiteYoloXConfig()
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the default is a confidence of 0.25 so this isn't changing the underlying behavior

@ejm714 ejm714 marked this pull request as ready for review May 16, 2024 01:57
@ejm714 ejm714 requested a review from pjbull May 16, 2024 02:15
pyproject.toml Outdated Show resolved Hide resolved
@jayqi jayqi merged commit da686dd into master May 17, 2024
15 checks passed
@jayqi jayqi deleted the fix-ffmpeg-install-on-macos branch May 17, 2024 02:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants