Skip to content
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

train/test split ID models #1902

Open
ralphpeterson opened this issue Aug 13, 2024 · 3 comments
Open

train/test split ID models #1902

ralphpeterson opened this issue Aug 13, 2024 · 3 comments
Assignees
Labels
2024-hackathon documentation This issue exists because the documentation is outdated.

Comments

@ralphpeterson
Copy link

ralphpeterson commented Aug 13, 2024

Hi all,

@Niegil-Francis and I are experimenting with 3D tracking using the new multi-view GUI + sleap-anipose and are getting the following error trying to train ID models (same error for both bottom-up and top-down). Any idea what could be going on here? Seems to be an issue in determining the train/test split.

Thanks!

Ralph

INFO:sleap.nn.training:Creating training and validation splits from validation fraction: 0.1
Traceback (most recent call last):
  File "C:\Users\daq2\anaconda3\envs\sleap_mv\Scripts\sleap-train-script.py", line 33, in <module>
    sys.exit(load_entry_point('sleap', 'console_scripts', 'sleap-train')())
  File "c:\users\daq2\niegil_codes\sleap\sleap\nn\training.py", line 2013, in main
    trainer = create_trainer_using_cli(args=args)
  File "c:\users\daq2\niegil_codes\sleap\sleap\nn\training.py", line 2005, in create_trainer_using_cli
    video_search_paths=args.video_paths,
  File "c:\users\daq2\niegil_codes\sleap\sleap\nn\training.py", line 673, in from_config
    with_track_only=is_id_model,
  File "c:\users\daq2\niegil_codes\sleap\sleap\nn\training.py", line 150, in from_config
    with_track_only=with_track_only,
  File "c:\users\daq2\niegil_codes\sleap\sleap\nn\training.py", line 218, in from_labels
    validation,
  File "c:\users\daq2\niegil_codes\sleap\sleap\nn\data\training.py", line 49, in split_labels_train_val
    idx_train, idx_val = train_test_split(list(range(len(labels))), test_size=n_val)
  File "C:\Users\daq2\anaconda3\envs\sleap_mv\lib\site-packages\sklearn\model_selection\_split.py", line 2423, in train_test_split
    n_samples, test_size, train_size, default_test_size=0.25
  File "C:\Users\daq2\anaconda3\envs\sleap_mv\lib\site-packages\sklearn\model_selection\_split.py", line 2046, in _validate_shuffle_split
    "(0, 1) range".format(test_size, n_samples)
ValueError: test_size=1 should be either positive and smaller than the number of samples 0 or a float in the (0, 1) range
@talmo
Copy link
Collaborator

talmo commented Aug 13, 2024

Hey @ralphpeterson,

Do you have a screenshot from the main GUI window? It looks like it's not finding the labeled frames in the project.

Thanks!

Talmo

@ralphpeterson
Copy link
Author

Thanks for the quick response! Here's a screenshot. It's worth noting that we do not see this error when training non-ID models.

gui

@talmo
Copy link
Collaborator

talmo commented Aug 13, 2024

Ahh, perfect contextual note!

Yes, for supervised ID models, the animals need to be assigned to a track and have that track be named consistently for all annotations of that same identity (double click the track name in the Instances tab if you want to rename it).

Since supervised ID models require a track to assign instances to classes, instances without a track are filtered out -- hence the issue with generating splits when you have 0 frames.

@eberrigan eberrigan added documentation This issue exists because the documentation is outdated. 2024-hackathon labels Dec 20, 2024
@eberrigan eberrigan self-assigned this Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2024-hackathon documentation This issue exists because the documentation is outdated.
Projects
None yet
Development

No branches or pull requests

3 participants