spoonsso / dannce

MIT License
214 stars 30 forks source link

Fintune with more than 6 cams #150

Closed Miaoing closed 1 year ago

Miaoing commented 1 year ago

Hi, Thank you or developing the excellent project!

I tried to run dannce with my own data. In our setting, there are 8 cams. If I run the prediction, with 'finetune' mode, there will be a Runtime Error.

Traceback (most recent call last):
  File "/home/vrlab/miniconda3/envs/dannce/bin/dannce-predict", line 33, in <module>
    sys.exit(load_entry_point('dannce', 'console_scripts', 'dannce-predict')())
  File "/home/vrlab/projects/mouse/dannce/dannce/cli.py", line 54, in dannce_predict_cli
    dannce_predict(params)
  File "/home/vrlab/projects/mouse/dannce/dannce/interface.py", line 1337, in dannce_predict
    training=False,
  File "/home/vrlab/projects/mouse/dannce/dannce/interface.py", line 1671, in do_COM_load
    exp = processing.dupe_params(exp, ["camnames"], n_views)
  File "/home/vrlab/projects/mouse/dannce/dannce/engine/processing.py", line 1295, in dupe_params
    duped.append(duped[i])
IndexError: list index out of range

How should I cope with this setting? Thank you very much for your response!

ksseverson57 commented 1 year ago

I recently worked around this issue by explicitly declaring how many camera views I have in the io.yaml or config.yaml file. If you add "n_views: 8" to the config and make sure you have 8 camnames in the dannce.mat file for this session, you should be able to work past this issue. In the future, we may want to make n_views equal to the length of camnames by default

Miaoing commented 1 year ago

Thank you very much! I tried to modify n_views to 8 before, but it seems that this method doesn't work for 'finetune' mode, because the pretrained UNet's shape is limited by 6 views.

I figured out a work-around way: Limit camnames to 6 in the file dannce/interface.py (line 1372), by slicing. camnames[0] = params["experiment"][0]["camnames"][:n_views]

In this way, it will use the pretrained network, and engate the first 6 views of the 8 cams for finetuning.