themattinthehatt / behavenet

Toolbox for analyzing behavioral videos and neural activity
https://behavenet.readthedocs.io/
MIT License
57 stars 15 forks source link

export_latents on a multisession only exports latents for one session #9

Closed johnmbarrett closed 4 years ago

johnmbarrett commented 4 years ago

Steps to reproduce:-

1) Fit an AE model to multiple experimental sessions by setting at least one of expt, animal, or session to "all" in the data config. Example data and configs are attached, rename john.zip to john.7z and extract the data to your data folder, then extract the configs to your .behavenet folder and run:

python behavenet/fitting/ae_grid_search.py --data_config ~/.behavenet/john_seed_handling_params.json --model_config ~/.behavenet/ae_model.json --training_config ~/.behavenet/ae_training.json --compute_config ~/.behavenet/ae_compute.json

Expected behaviour: all the latents are exported

Actual behaviour: all the latents are exported, but with the same file name, so all but the last one are overwritten. See excerpt from the console output when I tried this on my system (different dataset, hence the names are different):

exporting latents saving latents 1 of 13: Z:\LACIE\DATA\John\Videos\seed handling\behavenet\data\john\seed_handling\multisession-01\ae\conv\16_latents\all_head_fixed_search\version_0\john_seed_handling_2123327_Blue_20190424_latents.pkl saving latents 2 of 13: Z:\LACIE\DATA\John\Videos\seed handling\behavenet\data\john\seed_handling\multisession-01\ae\conv\16_latents\all_head_fixed_search\version_0\john_seed_handling_2123327_Blue_20190424_latents.pkl saving latents 3 of 13: Z:\LACIE\DATA\John\Videos\seed handling\behavenet\data\john\seed_handling\multisession-01\ae\conv\16_latents\all_head_fixed_search\version_0\john_seed_handling_2123327_Blue_20190424_latents.pkl saving latents 4 of 13: Z:\LACIE\DATA\John\Videos\seed handling\behavenet\data\john\seed_handling\multisession-01\ae\conv\16_latents\all_head_fixed_search\version_0\john_seed_handling_2123327_Blue_20190424_latents.pkl saving latents 5 of 13: Z:\LACIE\DATA\John\Videos\seed handling\behavenet\data\john\seed_handling\multisession-01\ae\conv\16_latents\all_head_fixed_search\version_0\john_seed_handling_2123327_Blue_20190424_latents.pkl saving latents 6 of 13: Z:\LACIE\DATA\John\Videos\seed handling\behavenet\data\john\seed_handling\multisession-01\ae\conv\16_latents\all_head_fixed_search\version_0\john_seed_handling_2123327_Blue_20190424_latents.pkl saving latents 7 of 13: Z:\LACIE\DATA\John\Videos\seed handling\behavenet\data\john\seed_handling\multisession-01\ae\conv\16_latents\all_head_fixed_search\version_0\john_seed_handling_2123327_Blue_20190424_latents.pkl saving latents 8 of 13: Z:\LACIE\DATA\John\Videos\seed handling\behavenet\data\john\seed_handling\multisession-01\ae\conv\16_latents\all_head_fixed_search\version_0\john_seed_handling_2123327_Blue_20190424_latents.pkl saving latents 9 of 13: Z:\LACIE\DATA\John\Videos\seed handling\behavenet\data\john\seed_handling\multisession-01\ae\conv\16_latents\all_head_fixed_search\version_0\john_seed_handling_2123327_Blue_20190424_latents.pkl saving latents 10 of 13: Z:\LACIE\DATA\John\Videos\seed handling\behavenet\data\john\seed_handling\multisession-01\ae\conv\16_latents\all_head_fixed_search\version_0\john_seed_handling_2123327_Blue_20190424_latents.pkl saving latents 11 of 13: Z:\LACIE\DATA\John\Videos\seed handling\behavenet\data\john\seed_handling\multisession-01\ae\conv\16_latents\all_head_fixed_search\version_0\john_seed_handling_2123327_Blue_20190424_latents.pkl saving latents 12 of 13: Z:\LACIE\DATA\John\Videos\seed handling\behavenet\data\john\seed_handling\multisession-01\ae\conv\16_latents\all_head_fixed_search\version_0\john_seed_handling_2123327_Blue_20190424_latents.pkl saving latents 13 of 13: Z:\LACIE\DATA\John\Videos\seed handling\behavenet\data\john\seed_handling\multisession-01\ae\conv\16_latents\all_head_fixed_search\version_0\john_seed_handling_2123327_Blue_20190424_latents.pkl

Additional comments: issue is in lines 68-72 of behavenet/fitting/eval.py, where the loop checks if the filename argument passed is None and creates an appropriate filename if so, but then overwrites the filename variable, so this check is not repeated on subsequent iterations.

themattinthehatt commented 4 years ago

thanks for the heads up @johnmbarrett, just fixed this issue (and the related issue for states and predictions). The new code is in the develop branch.