git clone https://github.com/dbolya/yolact.git
cd yolact
pip install opencv-python pillow==6.2.1 pycocotools matplotlib
pip install cython
pip install torch==1.2.0 torchvision==0.4.0 # CUDA10.Stable at 0
Compile DCNv2 when using yolact ++
cd external/DCNv2
python setup.py develop
Image
python eval.py
--trained_model=weights/yolact_base_54_800000.pth
--score_threshold=0.15
--top_k=15
--images=path/to/input/folder:path/to/output/folder
Video
python eval.py
--trained_model=weights/yolact_base_54_800000.pth
--score_threshold=0.15
--top_k=15
--video_multiframe=4
--video=input_video.mp4:output_video.mp4
Modify the config file (2 places) First fill in the database definition,
test_dataset = dataset_base.copy({
'name': 'Test Dataset',
'train_images': 'path_to_training_images',
'train_info': 'path_to_training_annotation',
'valid_images': 'path_to_validation_images',
'valid_info': 'path_to_validation_annotation',
'has_gt': True,
'class_names': ('my_class_id_1', 'my_class_id_2', 'my_class_id_3', ...)
})
Then change the default config file and exit.
```py:data/config.py
yolact_base_config = coco_base_config.copy({
'name': 'yolact_base',
# Dataset stuff
# 'dataset': coco2017_dataset, # default
'dataset': test_dataset, # Original Dataset
# 'num_classes': len(coco2017_dataset.class_names) + 1,
'num_classes': len(test_dataset.class_names) + 1,
})
```
Change config depending on model
Store the initial model (resnet50-19c8e357.pth) in save_folder
python train.py --config=yolact_plus_resnet50_config --save_folder=/path/to/workspace/ --save_interval=1000
Can be evaluated with the following code.
If you add --output_coco_json
to the end, you can generate json files under ~ / results /.
python eval.py --trained_model=weights/yolact_base_54_800000.pth
Recommended Posts