Skip to content

Jaap/fix coc oloader max individuals - #3435

Draft
deruyter92 wants to merge 3 commits into
mainfrom
jaap/fix-COCOloader-max-individuals
Draft

Jaap/fix coc oloader max individuals#3435
deruyter92 wants to merge 3 commits into
mainfrom
jaap/fix-COCOloader-max-individuals

Conversation

@deruyter92

@deruyter92 deruyter92 commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Fixes #3432.

COCOLoader.get_dataset_parameters derived bodyparts/individuals from train.json and ignored model_cfg.metadata, while DLCLoader treated the config as authoritative.

max_individuals had no effect on COCO projects, and training/evaluation could crash deep inside pad_to_length whenever an image had more individuals than the busiest training image.

  • model_cfg.metadata is now authoritative for bodyparts/individuals, matching DLCLoader.
  • Fail fast: COCOLoader now validates train.json/test.json against model_cfg.metadata at construction time, raising ValueError if an image has more individuals than the model supports, or if the annotated bodyparts don't match the configured ones.
  • get_project_parameters now optionally takes test_json and suggests max_individuals across both splits, instead of only train.json. docssting is updated to describe the non-authorative bootstrapping role of the method.
  • Updated the README and dev-docs snippets.
  • Added tests/pose_estimation_pytorch/data/test_cocoloader.py covering:
    • get_dataset_parameters uses model_cfg capacity (not the JSON) when it covers both splits
    • Construction raises ValueError when an image (train or test) exceeds the configured capacity
    • Construction raises ValueError on bodypart mismatch
    • Loader works without a test.json
    • get_project_parameters suggestions cover both train and test JSON, raise on an empty dataset, and warn on multi-category JSON (both splits)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

COCOLoader ignores max_individuals from the model config

1 participant