Code Monkey home page Code Monkey logo

yolact-gac's Introduction

Segmentation Refinement with GAC

based on the code from YOLACT: Real-time Instance Segmentation

Changes from the original YOLACT code

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

Installation

  • 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

Training

  • To train, grab an imagenet-pretrained model and put it in ./weights.
    • For Resnet50, download resnet50-19c8e357.pth from here.
  • 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.
# 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

Evaluation

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.

Quantitative Results on COCO

# 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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.