Replies: 4 comments 1 reply
-
Hi @catubc, Sorry, can you clarify what you mean by "delete the video frame"? Like you want to edit the MP4 to not have a particular frame? The Also, in your code where you're doing If you need to edit the actual video pixels, you'll need some logic for this, but I think you already have that based on the rendered video with the background blacked out. Let me know if this helps or if we can clarify further! Talmo |
Beta Was this translation helpful? Give feedback.
-
Hi @catubc, Great idea and initiative! Proofreading is something that could definitely be improved upon. The way I see this integrating with SLEAP:
For your own implementation:Seeing as you only want to retain a select few frames ( # Find indices of labeled frames to keep, note these are the indices of the `LabeledFrame`s in the labels.labeled_frames list
lf_indices = [0, 2, 7, 101] # Replace with list of labeled frame indices (NOT the same as video indices)
tracks_to_keep = ["animal0", "animal0", "animal1", "animal0"] # List of track names to keep (same size as `lf_indices`)
# Create a new `Labels` object containing only the matched `LabeledFrame`s
labels_keep = labels.extract(lf_indices, copy=True)
# Loop through matched `LabeledFrame`s
for lf in labels_keep.labeled_frames:
for inst_idx, inst in enumerate(lf.predicted_instances):
# Your code here
# Save new slp
new_slp_path = "path/new/slp"
sleap.Labels.save_file(labels_keep, new_slp_path) This won't create a new video, but you can more easily jump to the frames where the switches are more likely to occur (use Alt + L/R Arrow Key). |
Beta Was this translation helpful? Give feedback.
-
Ok, thank you both for the advice. We're getting pretty close now, only 1 step left: deleting specific tracks in each predicted frame that we keep.
I attach the code snippet + a screen grab of what we want. As you can see the .slp file has only 15-20 predicted frames (which is good), we just want to also delete very specific tracks within the remaining frames. Thanks so much,
|
Beta Was this translation helpful? Give feedback.
-
And @roomrys , thanks for the description of the steps for integrating this into Sleap. If it works, we're happy to help out implementing this. |
Beta Was this translation helpful? Give feedback.
-
Hello
We're working on a project using sleap bottom_up with ID to automatically detect identity swaps in predictions. The idea is:
Here's what the video looks like:
https://drive.google.com/file/d/10dlNPkS5G6t4Lf2Fm39r5bBj3n-keHTw/view?usp=sharing
The next step is to have a human go over these hybrid .slp files and fix these errors. We think this will be 10-100x faster than labeling single frames randomly and it appears to be a principled way to find places where the sleap NNs are getting confused.
However, we're a bit stuck on how to do a deep delete on an .slp file where we:
If this works, we're hoping to develop it into a feature that perhaps sleap engineers could code up.
Thanks so much,
@catubc
So far we have this code and it runs, but it only deletes predicted instances, the video is still just as big as the original video:
So this code should in principle output an .slp file with a single prediction at frame 1000 and be redirected to a new filename called 'file_short.slp' - which we'll have made separately (<- unless sleap can also do this for us).
Beta Was this translation helpful? Give feedback.
All reactions