-
Notifications
You must be signed in to change notification settings - Fork 101
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 cropping when rendering video #842
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #842 +/- ##
===========================================
+ Coverage 66.73% 66.85% +0.12%
===========================================
Files 129 129
Lines 21729 21742 +13
===========================================
+ Hits 14500 14535 +35
+ Misses 7229 7207 -22
📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more |
…l/render-video-crop
sleap/io/visuals.py
Outdated
except Exception as e: | ||
raise (e) | ||
finally: | ||
if writer_object is not None: | ||
writer_object.close() | ||
# send (-1, time) to signal done | ||
progress_queue.put((-1, total_elapsed)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are still able to get stuck in the code somewhere even with this try except finally
executing as expected. For example, I intentionally errored-out to this message but was not returned to the CLI:
(sleap_render-video-crop) λ python tests\liezl_test_script.py
Saving config: C:\Users\TalmoLab/.sleap/1.2.4/preferences.yaml
Writing video with 14100 frame images...
INFO:sleap.io.visuals:Chunks: 221, chunk size: 64
Done in 0.41996690000000036 s, fps = 33574.07452825446.
Exception in thread Thread-3:
Traceback (most recent call last):
File "C:\Users\TalmoLab\miniconda3\envs\sleap_render-video-crop\lib\threading.py", line 926, in _bootstrap_inner
self.run()
File "C:\Users\TalmoLab\miniconda3\envs\sleap_render-video-crop\lib\threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "d:\social-leap-estimates-animal-poses\pull-requests\sleap_render-video-crop\sleap\sleap\io\visuals.py", line 145, in writer
raise (e)
File "d:\social-leap-estimates-animal-poses\pull-requests\sleap_render-video-crop\sleap\sleap\io\visuals.py", line 126, in writer
h, w = data[0].shape[:2]
AttributeError: 'NoneType' object has no attribute 'shape'
Definitely getting stuck in the thread, now just need to figure out how to get unstuck.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opting to push the crop video fixes in this PR and handle the threading hang-up as a different issue.
…l/render-video-crop
…l/render-video-crop
…l/render-video-crop
Description
Although we allowed users to attempt to export a cropped version of their video - and had most of the code set-up to do so - there were still a few bugs making the crop feature unusable.
This PR allows users to render a cropped video that attempts to track instances in the frame - sometimes if instances move too fast, the crop does not follow in time due to smoothing or the crop may be too tiny to fit the instances.
Types of changes
Does this address any currently open issues?
Render Video > Crop Size: Half results in cv2.error #672
Outside contributors checklist
Thank you for contributing to SLEAP!
❤️