abhigoku10 / Yolact_minimal

Minimal PyTorch implementation of YOLACT.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Yolact_minimal

Minimal PyTorch implementation of Yolact:《YOLACT: Real-time Instance Segmentation》.
The original project is here.

This implementation simplified the original code, preserved the main function and made the network easy to understand.

Following instruction is based on resnet-101.

The network structure.

Example 0

Environments

PyTorch 1.1.
Python 3.6 or above.
Other common packages.

Prepare

Train

# Trains using the base config with a batch size of 8 (the default).
python train.py --config=yolact_base_config

# Resume training (just pass the .pth file to the model by using --resume).
python train.py --config=yolact_base_config --resume weights/yolact_base_2_35000.pth

# Using --batch_size, --lr, --momentum, --decay to set the batch size, learning rate, momentum and weight decay.
python train.py --config=yolact_base_config --batch_size=4

Val

# Evaluate on COCO val2017.
python eval.py --trained_model=weights/yolact_base_54_800000.pth

The results should be: Example 1

# Create a json file and then use the COCO API to evaluate the result.
python eval.py --config=yolact_base_config --cocoapi
# Then,
python coco_eval.py

# Benchmark
python eval.py --trained_model=weights/yolact_base_54_800000.pth --benchmark --max_images=1000

Detect

Example 2

# Detect images, pass the path of your image directory to --image.
python detect.py --trained_model=weights/yolact_base_54_800000.pth --image images
# Detect a video, pass the path of your video to --video.
python detect.py --trained_model=weights/yolact_base_54_800000.pth --video video/1.mp4
# Use --hide_mask, --hide_score, --show_lincomb and so on to get different results.
python detect.py --trained_model=weights/yolact_base_54_800000.pth --image images --hide_mask

About

Minimal PyTorch implementation of YOLACT.


Languages

Language:Python 100.0%