bethgelab / siamese-mask-rcnn

Siamese Mask R-CNN model for one-shot instance segmentation
Other
346 stars 60 forks source link

How to use the pretrained weights? #19

Closed twangnh closed 5 years ago

twangnh commented 5 years ago

Hi @michaelisc, thanks for sharing the work! I'm wondering how to use the released pretrained weights? they are named like large_siamese_mrcnn_coco_i1_0160.h5, but the checkpoint path in the eval ipynb is like '/home/wangtao/prj/siamese_mrcnn/experiments/logs/parallel_coco_full/siamese_mrcnn_0320.h5', so, should I download, rename and put the checkpoint into ./experiments/logs/parallel_coco_full/?

michaelisc commented 5 years ago

It depends, what you want to do. If you don't care about coco and want to apply the model use the model trained on all 80 coco categories large_siamese_mrcnn_coco_full_0320.h which you can download from the last release. You will have to create a checkpoints folder and put it in there. Then simply execute the evaluate.ipynb notebook. If you want to replicate our results on coco you have to download the checkpoints with i1 - i4 in their name and use the evaluation notebook from the experiments folder.

twangnh commented 5 years ago

Thanks for your response, I tried to use evaluate.ipynb with large_siamese_mrcnn_coco_full_0320.h5, however the following error is prompted

loading checkpoints/large_siamese_mrcnn_coco_full_0320.h5 ...
starting from epoch 320
Traceback (most recent call last):
  File "/home/wangtao/.pycharm_helpers/pydev/pydevd.py", line 1664, in <module>
    main()
  File "/home/wangtao/.pycharm_helpers/pydev/pydevd.py", line 1658, in main
    globals = debugger.run(setup['file'], None, None, is_module)
  File "/home/wangtao/.pycharm_helpers/pydev/pydevd.py", line 1068, in run
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "/home/wangtao/.pycharm_helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "/home/wangtao/prj/siamese_mrcnn/eval.py", line 119, in <module>
    model.load_checkpoint(checkpoint, training_schedule=train_schedule)
  File "/home/wangtao/prj/siamese_mrcnn/lib/model.py", line 860, in load_checkpoint
    schedule_index = min([key for key in training_schedule.keys() if epoch_index <= key])
ValueError: min() arg is an empty sequence

Process finished with exit code 1
twangnh commented 5 years ago

seems train_schedule should include 320 epoch setting

twangnh commented 5 years ago

I modify training_schedule to None, and it can work now

michaelisc commented 5 years ago

Your are right. Thanks for catching this error. Should be fixed with commit 4a97015.