GitHub - dbolya/yolact: A simple, fully convolutional model for real-time instan...
source link: https://github.com/dbolya/yolact
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
README.md
You Only Look At CoefficienTs
██╗ ██╗ ██████╗ ██╗ █████╗ ██████╗████████╗
╚██╗ ██╔╝██╔═══██╗██║ ██╔══██╗██╔════╝╚══██╔══╝
╚████╔╝ ██║ ██║██║ ███████║██║ ██║
╚██╔╝ ██║ ██║██║ ██╔══██║██║ ██║
██║ ╚██████╔╝███████╗██║ ██║╚██████╗ ██║
╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚═╝
A simple, fully convolutional model for real-time instance segmentation. This is the code for our paper, and for the forseeable future is still in development.
Here's a look at our current results for our base model (33 fps on a Titan Xp and 29.8 mAP on COCO's test-dev
):
Installation
- Set up a Python3 environment.
- Install Pytorch 1.0.1 (or higher) and TorchVision.
- Install some other packages:
# Cython needs to be installed before pycocotools pip install cython pip install opencv-python pillow pycocotools matplotlib
- Clone this repository and enter it:
git clone https://github.com/dbolya/yolact.git cd yolact
- If you'd like to train YOLACT, 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
- If you'd like to evaluate YOLACT on
test-dev
, downloadtest-dev
with this script.sh data/scripts/COCO_test.sh
Evaluation
As of April 5th, 2019 here are our latest models along with their FPS on a Titan Xp and mAP on test-dev
:
To evalute the model, put the corresponding weights file in the ./weights
directory and run one of the following commands.
Quantitative Results on COCO
# Quantitatively evaluate a trained model on the entire validation set. Make sure you have COCO downloaded as above. # This should get 29.92 validation mask mAP last time I checked. python eval.py --trained_model=weights/yolact_base_54_800000.pth # Output a COCOEval json to submit to the website or to use the run_coco_eval.py script. # This command will create './results/bbox_detections.json' and './results/mask_detections.json' for detection and instance segmentation respectively. python eval.py --trained_model=weights/yolact_base_54_800000.pth --output_coco_json # You can run COCOEval on the files created in the previous command. The performance should match my implementation in eval.py. python run_coco_eval.py # To output a coco json file for test-dev, make sure you have test-dev downloaded from above and go python eval.py --trained_model=weights/yolact_base_54_800000.pth --output_coco_json --dataset=coco2017_testdev_dataset
Qualitative Results on COCO
# Display qualitative results on COCO. From here on I'll use a confidence threshold of 0.3.
python eval.py --trained_model=weights/yolact_base_54_800000.pth --score_threshold=0.3 --top_k=100 --display
Benchmarking on COCO
# Run just the raw model on the first 1k images of the validation set
python eval.py --trained_model=weights/yolact_base_54_800000.pth --benchmark --max_images=1000
Images
# Display qualitative results on the specified image. python eval.py --trained_model=weights/yolact_base_54_800000.pth --score_threshold=0.3 --top_k=100 --image=my_image.png # Process an image and save it to another file. python eval.py --trained_model=weights/yolact_base_54_800000.pth --score_threshold=0.3 --top_k=100 --image=input_image.png:output_image.png # Process a whole folder of images. python eval.py --trained_model=weights/yolact_base_54_800000.pth --score_threshold=0.3 --top_k=100 --images=path/to/input/folder:path/to/output/folder
Video
# Display a video in real-time # I have to work out the kinks for this one. Drawing the frame takes more time than executing the network resulting in sub-30 fps :/ python eval.py --trained_model=weights/yolact_base_54_800000.pth --score_threshold=0.3 --top_k=100 --video=my_video.mp4 # Process a video and save it to another file. python eval.py --trained_model=weights/yolact_base_54_800000.pth --score_threshold=0.3 --top_k=100 --video=input_video.mp4:output_video.mp4
As you can tell, eval.py
can do a ton of stuff. Run the --help
command to see everything it can do.
python eval.py --help
Training
- To train, grab an imagenet-pretrained model and put it in
./weights
. - Run one of the training commands below.
- Note that you can press ctrl+c while training and it will save an
*_interrupt.pth
file at the current iteration. - All weights are saved in the
./weights
directory by default with the file name<config>_<epoch>_<iter>.pth
.
- Note that you can press ctrl+c while training and it will save an
# Trains using the base config with a batch size of 8 (the default). python train.py --config=yolact_base_config # Trains yolact_base_config with a batch_size of 5 (suprise). For the 550px models, 1 batch takes up around 1.8 gigs of VRAM, so specify accordingly. python 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. python 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 python train.py --help
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK