Skip to content

Conversation

@Tetra-quark
Copy link
Contributor

@Tetra-quark Tetra-quark commented Oct 5, 2023

Pull request to fix issue #2390

TODOs:

  • Fix getting pose_cfg paths in nested loop over shuffle and trainingfractions. Needs to be able to handle trainingsetindex='all'. Fix needs to be applied to evaluate.py and multianimal_evaluate.py.
  • Look for other usages of get_data_and_metadata_filenames in other areas of the project and evaluate whether to replace with these with simple dict access from pose_cfg. (For file creation the method should be used but I think afterwards ideally it should be accessed from pose_cfg).
  • Rename variable dlc_cfg to test_pose_cfg to be more specific and mirror the naming of train_pose_cfg
  • Handle exception if train/pose_cfg.yaml is not found similarly to how load test config is in a try/catch block.
  • Update visualizemaps.py

Tetra-quark and others added 4 commits September 22, 2023 11:07
- Remove unsued dataset path.
- Fix getting metadataset. Now obtained from config rather than auxiliary function.
- Suppress unused return values from load_metadataset.
- Move load_metadata to where it is explicitly needed.
- Get metadataset file path from config rather than auxiliary function.
- Use return_train_network_path function to get train/test pose_cfg paths
- Move load_metadata to after try-catch block.
- Get metadataset file path from config rather than auxiliary function.
- Suppress redefined TrainFraction from load_metadata function.
- Use return_train_network_path function to get train/test pose_cfg paths
- Move load_metadata to after try-catch block.
- Fix minor naming/formatting issues
@Tetra-quark Tetra-quark changed the title Fix bug dataset and metadataset fixes #2390 Fix bug dataset and metadataset fixes DeepLabCut/DeepLabCut#2390 Oct 5, 2023
@MMathisLab MMathisLab requested a review from jeylau October 6, 2023 13:28
@AlexEMG
Copy link
Member

AlexEMG commented Oct 9, 2023

Thanks!

@AlexEMG AlexEMG requested a review from n-poulsen October 9, 2023 20:49
- Fix handling of trainingsetindex="all"
- Replace Try/Except on test/pose_cfg with check if modelfolder exists so it covers both train and test pose_cfgs.
- Add TODO related to FileNotFoundError
- Minor Refactoring
- Fix handling of trainingsetindex="all"
- Replace Try/Except on test/pose_cfg with check if modelfolder exists so it covers both train and test pose_cfgs.
- Add TODO related to FileNotFoundError
- Minor Refactoring
@Tetra-quark
Copy link
Contributor Author

Tetra-quark commented Oct 17, 2023

I have looked for other areas of the code that use get_data_and_metadata_filenames they are either related to dataset/metadataset file creation (no need to change these) or are test scripts where it matters less how these filenames are accessed.

However, visualizemaps.py should be updated given it's structural similiarity to evaluate.py and evaluate_multianimal.py. But before doing that I was hoping to get some feedback on the code review I opened above as it is relevant to all three files.

I also wanted to note explicitly that my changes now mean that the metadataset parameter in the train/pose_cfg.yaml is being accessed by modules that previously only accessed the test/pose_cfg.yaml. This is because while there is a dataset parameter in the test/pose_cfg.yaml as far as I can see from the testing scripts there is no metadataset parameter.

@Tetra-quark Tetra-quark marked this pull request as ready for review October 17, 2023 13:07
@MMathisLab MMathisLab added enhancement New feature or request documentation documentation updates/comments bug fix! fix for a real buggy one... labels Oct 27, 2023
Copy link
Contributor

@jeylau jeylau left a comment

Choose a reason for hiding this comment

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

Thanks @Tetra-quark! I'd only ask you to load the train image indices outside the loop, and that looks great!

- Load config and metadata outside nested loop.
@jeylau
Copy link
Contributor

jeylau commented Oct 30, 2023

Great, thanks! I think this is good to merge, and if some code refactoring is needed in evaluate/visualizemaps, that can be done in a separate PR @MMathisLab @Tetra-quark.

Copy link
Contributor

@n-poulsen n-poulsen left a comment

Choose a reason for hiding this comment

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

Some minor stye comments, otherwise looks good to me

@Tetra-quark Tetra-quark requested a review from n-poulsen December 2, 2023 15:12
@MMathisLab MMathisLab merged commit 0f657cd into DeepLabCut:main Dec 7, 2023
@Tetra-quark Tetra-quark deleted the fix_bug_dataset_and_metadataset branch December 30, 2023 18:38
@MMathisLab MMathisLab mentioned this pull request Feb 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug fix! fix for a real buggy one... documentation documentation updates/comments enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants