E52C Cleanup frames by gsaaad · Pull Request #2944 · DeepLabCut/DeepLabCut · GitHub
[go: up one dir, main page]

Skip to content

Conversation

@gsaaad
Copy link
@gsaaad gsaaad commented Apr 4, 2025

This contribution introduces a new feature within DeepLabCut that allows users to remove or clean up frames directly in the DLC environment. Specifically:
GUI Grid Image Viewer: A modal window now appears, displaying frames in a grid so that users can visually inspect each image.

Frame Deletion within DLC: Users can select and delete frames from a chosen dataset, enabling easier refinement of curated frames without having to leave the DLC interface.

Smoother workflow, from extracting frames -> cleaning up frames -> labelling frames.

@gsaaad
Copy link
Author
gsaaad commented Apr 4, 2025

@AlexEMG

@MMathisLab
Copy link
Member

thanks @gsaaad ! Could I ask you to give me the output of the test script (see contributor guide💜), and if you have a short demo video or screenshots, that would be ideal for to check, also for documentation :D

@gsaaad
Copy link
Author
gsaaad commented Apr 9, 2025

Please check the following for an output of the test script, followed by a quick walkthrough of the remove-frames functionality built into DLC's environment
DLC_test_output.txt

DLC_Walkthrough.mp4

@gsaaad
Copy link
Author
gsaaad commented Apr 10, 2025

I've uploaded a text file of the testscript output and included a quick walkthrough of the remove_frames function in a video format.
The user can remove unwanted frames in a grid-viewer using the DLC's GUI theme directly in the environment.

Please let me know if you need anything else.

@MMathisLab
Copy link
Member

Thank you! Looks like a nice visual way to do some clean up post frame extraction!

Just to clarify, in general if a user skips a frame it is not used in DLC for training, so they can stay in the directory without any issue.

If a frame gets labeled, but then deleted for any reason, we have some helper functions:

https://deeplabcut.github.io/DeepLabCut/docs/HelperFunctions.html

such as: deeplabcut.dropannotationfileentriesduetodeletedimages

@MMathisLab MMathisLab added the enhancement New feature or request label Apr 11, 2025
@MMathisLab MMathisLab removed the request for review from n-poulsen April 14, 2025 09:44
@gsaaad
Copy link
Author
gsaaad commented Apr 25, 2025

Let me know what you require to proceed

@AlexEMG
Copy link
Member
AlexEMG commented Apr 26, 2025

Thanks for the contribution -- @maximpavliv is on vacation. We'll discuss it in the next dev meeting when he is back (early May).

@maximpavliv
Copy link
Contributor
maximpavliv commented May 12, 2025

Hi @gsaaad

Thanks for opening this Pull Request!

I noticed that one of the commits applies black formatting to many files unrelated to your changes. While we appreciate clean, formatted code, we try to keep unrelated formatting changes separate from functional changes so it's easier to review and track changes over time.

Could you please remove that formatting commit from this PR? Instead, if you could apply black only to the files you modified - that would be perfect!
In order to apply black formatting only to certain files, you can do:
black path/to/modified_file1.py path/to/modified_file2.py

Let me know if you need help with the git steps — happy to guide you!

@MMathisLab MMathisLab requested review from C-Achard and deruyter92 and removed request for maximpavliv January 14, 2026 15:08
…nize frames directly within the dlc environment.
…owing users to remove any frames that are miscallanous or not needed for organizing frames
@deruyter92
Copy link
Collaborator

Undid the Black formatting, focusing only on the changed files now.

- renamed Image_grid_viewer.py -> image_grid_viewer.py (lowercase)
- ran black on image_grid_viewer and label_frames
lamda argument may be changed when function is called. Replacing lambdas with closure functions.
Copy link
Collaborator
@deruyter92 deruyter92 left a comment

Choose a reason for hiding this comment

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

The idea is useful. Thanks for the contribution!

The code looks fine! added a few minor changes:

  • Only applied formatting to the changed files (and renamed to lowercase filename)
  • Added error handling (e.g. when files cannot be read)
  • Replaced lambdas with closure functions

Required changes:
One of the major things that need to be considered is how to handle removed frames. Just removing them on disk might not be a good idea. e.g. after deletion, associated annotation files (.h5, .pickle) aren't handled.

@deruyter92 deruyter92 added the WORK IN PROGRESS! developers are currently working on this feature... stay tuned. label Jan 15, 2026
@C-Achard
Copy link
Collaborator

(@deruyter92 Another small thing would be that we may want to move the QtImageGridViewer to a different location, within gui probably)

@gsaaad
Copy link
Author
gsaaad commented Jan 15, 2026

Yes, it was added in that section as part of the efficient workflow:
Extracting frames -> cleaning up frames -> labelling frames.
but im more than happy to assist further

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request WORK IN PROGRESS! developers are currently working on this feature... stay tuned.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

0