zju3dv / snake

Code for "Deep Snake for Real-Time Instance Segmentation" CVPR 2020 oral
Other
1.15k stars 229 forks source link

How should I train my own coco-type dataset? #32

Closed evan0621 closed 4 years ago

evan0621 commented 4 years ago

How to train, test, and visualize on our coco-type dataset?

pengsida commented 4 years ago

The easiest way is to change data_root and ann_file of CocoTrain and CocoVal in https://github.com/zju3dv/snake/blob/master/lib/datasets/dataset_catalog.py

And then

python train_net.py --cfg_file snake/sbd_snake.yaml model custom_model train.dataset CocoTrain test.dataset CocoVal
python run.py --type evaluate --cfg_file snake/sbd_snake.yaml model custom_model train.dataset CocoTrain test.dataset CocoVal
python run.py --type visualize --cfg_file snake/sbd_snake.yaml model custom_model train.dataset CocoTrain test.dataset CocoVal
RonDen commented 4 years ago

Installed /ldap_shared/home/s_zyt/.pyenv/versions/anaconda3-2019.07/envs/snake/lib/python3.7/site-packages/apex-0.1-py3.7-linux-x86_64.egg
Processing dependencies for apex==0.1
Finished processing dependencies for apex==0.1
(anaconda3-2019.07/envs/snake) ➜  apex git:(master) cd ..
(anaconda3-2019.07/envs/snake) ➜  inseg cd code/snake 
(anaconda3-2019.07/envs/snake) ➜  snake git:(master) ✗ ls
INSTALL.md  README.md  configs  demo_images  lib                   requirements.txt  run.sh   tools         visualize.sh
LICENSE     assets     data     external     project_structure.md  run.py            test.sh  train_net.py
(anaconda3-2019.07/envs/snake) ➜  snake git:(master) ✗ cd lib/csrc 
(anaconda3-2019.07/envs/snake) ➜  csrc git:(master) ✗ ls
dcn_v2  extreme_utils  roi_align_layer
(anaconda3-2019.07/envs/snake) ➜  csrc git:(master) ✗ cd dcn_v2 
(anaconda3-2019.07/envs/snake) ➜  dcn_v2 git:(master) ✗ python setup.py build_ext --inplace
running build_ext
copying build/lib.linux-x86_64-3.7/_ext.cpython-37m-x86_64-linux-gnu.so -> 
(anaconda3-2019.07/envs/snake) ➜  dcn_v2 git:(master) ✗ cd ../extreme_utils 
(anaconda3-2019.07/envs/snake) ➜  extreme_utils git:(master) ✗ python setup.py build_ext --inplace
running build_ext
copying build/lib.linux-x86_64-3.7/_ext.cpython-37m-x86_64-linux-gnu.so -> 
(anaconda3-2019.07/envs/snake) ➜  extreme_utils git:(master) ✗ cd ../roi_align_layer 
(anaconda3-2019.07/envs/snake) ➜  roi_align_layer git:(master) ✗ l
total 7.1M
drwxr-xr-x 5 2014 504 4.0K Apr 22 08:57 .
drwxr-xr-x 5 2014 504 4.0K Apr  6 20:51 ..
-rw-r--r-- 1 2014 504 1.7K Apr  6 20:51 ROIAlign.h
-rwxr-xr-x 1 2014 504 7.0M Apr 22 08:57 _roi_align.cpython-37m-x86_64-linux-gnu.so
drwxr-xr-x 4 2014 504 4.0K Apr 22 08:57 build
drwxr-xr-x 2 2014 504 4.0K Apr  6 20:51 cpu
drwxr-xr-x 2 2014 504 4.0K Apr  6 20:51 cuda
-rw-r--r-- 1 2014 504 2.2K Apr  6 20:51 roi_align.py
-rw-r--r-- 1 2014 504 1.8K Apr  6 20:51 setup.py
-rw-r--r-- 1 2014 504  282 Apr  6 20:51 vision.cpp
(anaconda3-2019.07/envs/snake) ➜  roi_align_layer git:(master) ✗ python setup.py build_ext --inplace
running build_ext
copying build/lib.linux-x86_64-3.7/_roi_align.cpython-37m-x86_64-linux-gnu.so -> 
(anaconda3-2019.07/envs/snake) ➜  roi_align_layer git:(master) ✗ cd ..
(anaconda3-2019.07/envs/snake) ➜  csrc git:(master) ✗ cd ..
(anaconda3-2019.07/envs/snake) ➜  lib git:(master) ✗ cd ..

anaconda3-2019.07/envs/snak ) ➜  snake git:(master) ✗  python train_net.py --cfg_file configs/sbd_snake.yaml model custom_model train.dataset CocT   Traceback (most recent call last):
  File "train_net.py", line 54, in <module>
    main()
  File "train_net.py", line 46, in main
    network = make_network(cfg)
  File "/ldap_shared/home/s_zyt/inseg/code/snake/lib/networks/make_network.py", line 23, in make_network
    return imp.load_source(module, path).get_network(cfg)
  File "/ldap_shared/home/s_zyt/.pyenv/versions/anaconda3-2019.07/envs/snake/lib/python3.7/imp.py", line 171, in load_source
    module = _load(spec)
  File "<frozen importlib._bootstrap>", line 696, in _load
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "lib/networks/snake/__init__.py", line 2, in <module>
    from .ct_snake import get_network as get_ro
  File "lib/networks/snake/ct_snake.py", line 2, in <module>
    from .dla import DLASeg
  File "lib/networks/snake/dla.py", line 16, in <module>
    from lib.networks.dcn_v2 import DCN
  File "/ldap_shared/home/s_zyt/inseg/code/snake/lib/networks/dcn_v2.py", line 13, in <module>
    from lib.csrc.dcn_v2 import _ext as _backend
ImportError: /ldap_shared/home/s_zyt/inseg/code/snake/lib/csrc/dcn_v2/_ext.cpython-37m-x86_64-linux-gnu.so: undefined symbol: _ZN6caffe28TypeMeta21_typeMetaDataInstanceIN3c108BFloat16EEEPKNS_6detail12TypeMetaDataEv

From the log, it seems my installation is right. The dcn_v2, extreme_utils and roi_align_layer all installed. But I still got this error.

Environment:

pengsida commented 4 years ago

https://github.com/zju3dv/snake/issues/26

pengsida commented 4 years ago

Before re-compiling the code, you need to remove the build directory under snake/lib/csrc/dcn_v2/.