Giter VIP home page Giter VIP logo

retinanet_pytorch's Introduction

RetinaNet_pytorch

A Python3.5/Pytroch implementation of RetinaNet: Focal Loss for Dense Object Detection. And the official implementations are available here. Besides, special thanks for those two repositories:

Prerequisites

  • python 3.5.x
  • pytorch 0.4.1
  • tensorboardX
  • pillow
  • scipy
  • numpy
  • matplotlib
  • easydict

Results

mAP

  • Backbone: ResNet50
VOC2007 LUNA16
76.6 65.4

Acc and Loss

The training loss and accuracy :

Alt text

Detection Results

VOC2007 detection results: Alt text

LUNA16: lung nodules detection. The mAP for different anchor scale and aspect ratios:

Anchor_Scale Anchor_Size Aspect_ratio mAP
4 (32, 64, 128, 256, 512) (1.0, 2.0, 0.5) 46.2
1 (8, 16, 32, 64, 128) (1.0, 2.0, 0.5) 54.1
1 (8, 16, 32, 64, 128) (1.0) 56.5
1 (8, 16, 32, 64, 128) (1.0, 1.2, 0.8) 65.4

LUNA16 detection results: Alt text

Repo Organization

  • RetinaNet: neural networks and components that form parts of RetinaNet.
  • config: define configuration information of Faster RCNN.
  • data: scripts for creating, downloading, organizing datasets.
  • loss: implementation of focal loss.
  • pretrained_model: get and store pretrained ResNet model.
  • targets: generate anchors and calculate targets.
  • utils: tools package, containing some necessary functions.

Installation

  1. Clone this repository (RetinaNet_pytorch):

     git clone --recursive https://github.com/Jacqueline121/RetinaNet_pytorch.git
    
  2. Install dependencies:

     cd RetinaNet_pytorch 
     pip install -r requirements.txt
    

Train

Prepare the Data

For PASCAL VOC, you can follow the instructions in this repository to download the data. And then, you can store date according the following structure:

|+-- data    
|   |+-- dataset    
|       |+-- VOC2007    
|           |+-- Annotations    
|               |+-- xxxx.xml    
|           |+-- Cache    
|           |+-- ImageSets    
|           |+-- JPEGImages    
|           |+-- Results    
|       |+-- VOC2012    
|           |+-- Annotations    
|               |+-- xxxx.xml    
|           |+-- Cache    
|           |+-- ImageSets    
|           |+-- JPEGImages    
|           |+-- Results    
  • Annotations: store annotaion information(.xml file) for each images.
  • Cache: store annotaion cache.
  • ImageSets: store training dataset and testing dataset(.txt file) with the format:
  • JPEGImages: store images.
  • Results: store detection results.

You can also use your own dataset as long as you follow the file structure desribed above to store the data.

Get pretrained model

  1. Download the pretrained ResNet model: ResNet50, ResNet101.

  2. Put the pretrained model in $PROJECT/pretrained_model

  3. cd $PROJECT/pretrained_model

     python get_pretrained_model.py
    

    It will produce a 'model.pth' file.

Train

python train.py --dataset='Dataset_Name'

For example: python train.py --dataset='VOC2007'

Test

python test.py --dataset='VOC2007'

If you want to visualize the detection result, you can use:

python test.py --vis

retinanet_pytorch's People

Contributors

jacqueline121 avatar

Watchers

James Cloos avatar paper2code - bot avatar

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.