A simple, fully convolutional model for real-time instance segmentation. This is the code for papers:
# Cython needs to be installed before pycocotools
pip3 install cython
pip3 install opencv-python pillow pycocotools matplotlib
If you want to use YOLACT++, compile deformable convolutional layers (from DCNv2).
cd external/DCNv2
python3 setup.py build develop
Go to visit COCO official website, then select the COCO dataset you want to download.
Take coco2017 dataset as an example, specify /path/to/coco2017
to your COCO path in later training process, the unzipped dataset path structure sholud look like:
coco2017
├── annotations
│ ├── instances_train2017.json
│ ├── instances_val2017.json
│ └── ...
├── train2017
│ ├── 000000000009.jpg
│ ├── 000000000025.jpg
│ └── ...
├── val2017
│ ├── 000000000139.jpg
│ ├── 000000000285.jpg
│ └── ...
├── train2017.txt
├── val2017.txt
└── ...
Modify the configuration file(data/config.py)
$ vim data/config.py
$ # 'train_images': the path of train images
$ # 'train_info': the path of train_info
$ # 'valid_images': the path of valid images
$ # 'valid_info': the path of valid_info
By default, we train on COCO. Make sure to download the entire dataset using the commands above.
./weights
.
*_interrupt.pth
file at the current iteration../weights
directory by default with the file name <config>_<epoch>_<iter>.pth
.# Trains using the base config with a batch size of 8 (the default).
python3 train.py --config=yolact_base_config
# Trains yolact_base_config with a batch_size of 5. For the 550px models, 1 batch takes up around 1.5 gigs of VRAM, so specify accordingly.
python3 train.py --config=yolact_base_config --batch_size=5
# Resume training yolact_base with a specific weight file and start from the iteration specified in the weight file's name.
python3 train.py --config=yolact_base_config --resume=weights/yolact_base_10_32100.pth --start_iter=-1
# Use the help option to see a description of all available command line arguments
python3 train.py --help
YOLACT now supports multiple GPUs seamlessly during training:
export CUDA_VISIBLE_DEVICES=[gpus]
nvidia-smi
.8*num_gpus
with the training commands above. The training script will automatically scale the hyperparameters to the right values.
--batch_alloc=[alloc]
where [alloc] is a comma seprated list containing the number of images on each GPU. This must sum to batch_size
.For example: use 8 GPUs to train.
export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7
python3 train.py --config=yolact_base_config --batch_size 64 --lr 0.000125
all | .50 | .55 | .60 | .65 | .70 | .75 | .80 | .85 | .90 | .95 | |
---|---|---|---|---|---|---|---|---|---|---|---|
box | 11.64 | 23.13 | 21.51 | 19.36 | 16.98 | 14.19 | 10.93 | 6.83 | 2.83 | 0.61 | 0.05 |
mask | 11.20 | 20.51 | 19.07 | 17.51 | 15.52 | 13.23 | 10.74 | 8.10 | 5.13 | 2.06 | 0.13 |
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。