based on the code from YOLACT: Real-time Instance Segmentation
eval.py lines 411-426, adding the ability to do refinement with GAC
train_GAC_loss.py lines 34-120, copy of train.py with the GAC loss, calaulate the distance maps and changing the data loader
layers/modules/multibox_loss2.py lines 34-120, copy of multibox_loss.py with the added GAC loss
few more minor changes to pass the distance maps to the loss module
- Clone this repository and enter it:
git clone https://github.com/tomer196/YOLACT-GAC.git cd YOLACT-GAC
- Set up the environment using one of the following methods:
- Set up a Python3 environment (e.g., using virtenv).
- Install packages:
# Cython needs to be installed before pycocotools pip install Cython==0.29.15 pip install -r requirments.txt
- download the COCO dataset and the 2014/2017 annotations. Note that this script will take a while and dump 21gb of files into
./data/coco
.sh data/scripts/COCO.sh
- To train, grab an imagenet-pretrained model and put it in
./weights
.- For Resnet50, download
resnet50-19c8e357.pth
from here.
- For Resnet50, download
- Run one of the training commands below.
- All weights are saved in the
./weights
directory by default with the file name<config>_<epoch>_<iter>.pth
.
- All weights are saved in the
# Trains using the original losses
python train.py --config=yolact_resnet50_config
# Trains using the original losses + GAC loss
python train_GAC_loss.py --config=yolact_resnet50_config
You can download the YOLACT trained models:
Backbone | Weights | |
---|---|---|
Original | Resnet50 | yolact_resnet50_54_800000.pth |
With GAC loss | Resnet50 | yolact_resnet50_GAC.pth |
To evalute the model, put the corresponding weights file in the ./weights
directory and run one of the following commands.
# Quantitatively evaluate the original trained model.
python eval.py --trained_model=weights/yolact_resnet50_54_800000.pth
# Quantitatively evaluate my trained model with GAC loss.
python eval.py --trained_model=weights/yolact_resnet50_GAC.pth
# or any train model in weights/
# to evaluate with the GAC refinement add the --GAC flag
python eval.py --trained_model=weights/yolact_resnet50_54_800000.pth --GAC
python eval.py --trained_model=weights/yolact_resnet50_GAC.pth --GAC