https://github.com/ataraxialab/ssd.pytorch

A PyTorch Implementation of Single Shot MultiBox Detector.

https://github.com/ataraxialab/ssd.pytorch

Science Score: 10.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: arxiv.org
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (15.0%) to scientific vocabulary
Last synced: 9 months ago · JSON representation

Repository

A PyTorch Implementation of Single Shot MultiBox Detector.

Basic Info
  • Host: GitHub
  • Owner: ataraxialab
  • License: mit
  • Language: Python
  • Default Branch: master
  • Homepage:
  • Size: 95.6 MB
Statistics
  • Stars: 1
  • Watchers: 4
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Fork of amdegroot/ssd.pytorch
Created about 9 years ago · Last pushed about 9 years ago

https://github.com/ataraxialab/ssd.pytorch/blob/master/

# SSD: Single Shot MultiBox Object Detector, in PyTorch
A [PyTorch](http://pytorch.org/) implementation of [Single Shot MultiBox Detector](http://arxiv.org/abs/1512.02325) from the 2016 paper by Wei Liu, Dragomir Anguelov, Dumitru Erhan, Christian Szegedy, Scott Reed, Cheng-Yang, and Alexander C. Berg.  The official and original Caffe code can be found [here](https://github.com/weiliu89/caffe/tree/ssd).  




### Table of Contents
- Installation
- Datasets
- Train
- Evaluate
- Demos
- Future Work
- Reference

 
 
 
 

## Installation
- Install [PyTorch](http://pytorch.org/) by selecting your environment on the website and running the appropriate command.
- Clone this repository.
  * Note: We only guarantee full functionality with Python 3.
- Then download the dataset by following the [instructions](#download-voc2007-trainval--test) below.
- We now support [Visdom](https://github.com/facebookresearch/visdom) for real-time loss visualization during training! 
  * To use Visdom in the browser: 
  ```Shell
  # First install Python server and client 
  pip install visdom
  # Start the server (probably in a screen or tmux)
  python -m visdom.server
  ```
  * Then (during training) navigate to http://localhost:8097/ (see the Train section below for training details).
- Note: For training, we currently only support [VOC](http://host.robots.ox.ac.uk/pascal/VOC/), but are adding [COCO](http://mscoco.org/) and hopefully [ImageNet](http://www.image-net.org/) soon.

## Datasets
To make things easy, we provide a simple VOC dataset loader that enherits `torch.utils.data.Dataset` making it fully compatible with the `torchvision.datasets` [API](http://pytorch.org/docs/torchvision/datasets.html).

### VOC Dataset
##### Download VOC2007 trainval & test

```Shell
# specify a directory for dataset to be downloaded into, else default is ~/data/
sh data/scripts/VOC2007.sh # 
```

##### Download VOC2012 trainval

```Shell
# specify a directory for dataset to be downloaded into, else default is ~/data/
sh data/scripts/VOC2012.sh # 
```

 Ensure the following directory structure (as specified in [VOCdevkit](http://host.robots.ox.ac.uk/pascal/VOC/voc2007/devkit_doc_07-Jun-2007.pdf)):

```
VOCdevkit/                                  % development kit
VOCdevkit/VOC2007/ImageSets                 % image sets
VOCdevkit/VOC2007/Annotations               % annotation files
VOCdevkit/VOC2007/JPEGImages                % images
VOCdevkit/VOC2007/SegmentationObject        % segmentations by object
VOCdevkit/VOC2007/SegmentationClass         % segmentations by class
```

## Training SSD
- First download the fc-reduced [VGG-16](https://arxiv.org/abs/1409.1556) PyTorch base network weights at:              https://s3.amazonaws.com/amdegroot-models/vgg16_reducedfc.pth
- By default, we assume you have downloaded the file in the `ssd.pytorch/weights` dir:

```Shell
mkdir weights
cd weights
wget https://s3.amazonaws.com/amdegroot-models/vgg16_reducedfc.pth
```

- To train SSD using the train script simply specify the parameters listed in `train.py` as a flag or manually change them.

```Shell
python train.py
```
- Training Parameter Options: 

```Python
'--version', default='v2', help='conv11_2(v2) or pool6(v1) as last layer'
'--basenet', default='vgg16_reducedfc.pth', help='pretrained base model'
'--jaccard_threshold', default=0.5, type=float, help='Min Jaccard index for matching'
'--batch_size', default=16, type=int, help='Batch size for training'
'--num_workers', default=4, type=int, help='Number of workers used in dataloading'
'--iterations', default=120000, type=int, help='Number of training epochs'
'--cuda', default=True, type=bool, help='Use cuda to train model'
'--lr', '--learning-rate', default=1e-3, type=float, help='initial learning rate'
'--momentum', default=0.9, type=float, help='momentum'
'--weight_decay', default=5e-4, type=float, help='Weight decay for SGD'
'--gamma', default=0.1, type=float, help='Gamma update for SGD'
'--log_iters', default=True, type=bool, help='Print the loss at each iteration'
'--visdom', default=True, type=bool, help='Use visdom to for loss visualization'
'--save_folder', default='weights/', help='Location to save checkpoint models'
```
- Note:
  * For training, an NVIDIA GPU is strongly recommended for speed.
  * Currently we only support training on v2 (the newest version).
  * For instructions on Visdom usage/installation, see the Installation section.
  
## Evaluation
To evaluate a trained network:

```Shell
python test.py
```

You can specify the parameters listed in the `test.py` file by flagging them or manually changing them.  




## Demos

### Use a pre-trained SSD network for detection

#### Download a pre-trained network
- We are trying to provide PyTorch `state_dicts` (dict of weight tensors) of the latest SSD model definitions trained on different datasets.  
- Currently, we provide the following PyTorch models: 
    * SSD300 v2 trained on VOC0712 (newest version)
      - https://s3.amazonaws.com/amdegroot-models/ssd_300_VOC0712.pth
    * SSD300 v1 (original/old pool6 version) trained on VOC07
      - https://s3.amazonaws.com/amdegroot-models/ssd_300_voc07.tar.gz
- Our goal is to reproduce this table from the [original paper](http://arxiv.org/abs/1512.02325) 

SSD results on multiple datasets

### Try the demo notebook - Make sure you have [jupyter notebook](http://jupyter.readthedocs.io/en/latest/install.html) installed. - Two alternatives for installing jupyter notebook: 1. If you installed PyTorch with [conda](https://www.continuum.io/downloads) (recommended), then you should already have it. (Just navigate to the ssd.pytorch cloned repo and run): `jupyter notebook` 2. If using [pip](https://pypi.python.org/pypi/pip): ```Shell # make sure pip is upgraded pip3 install --upgrade pip # install jupyter notebook pip install jupyter # Run this inside ssd.pytorch jupyter notebook ``` - Now navigate to `demo.ipynb` at http://localhost:8888 (by default) and have at it! ## TODO We have accumulated the following to-do list, which you can expect to be done in the very near future - Complete data augmentation (in progress) - Train SSD300 with batch norm (in progress) - Webcam demo (in progress) - Add support for SSD512 training and testing - Add support for COCO dataset - Create a functional model definition for Sergey Zagoruyko's [functional-zoo](https://github.com/szagoruyko/functional-zoo) (in progress) ## References - Wei Liu, et al. "SSD: Single Shot MultiBox Detector." [ECCV2016]((http://arxiv.org/abs/1512.02325)). - [Original Implementation (CAFFE)](https://github.com/weiliu89/caffe/tree/ssd) - A list of other great SSD ports that were sources of inspiration (especially the Chainer repo): * [Chainer](https://github.com/Hakuyume/chainer-ssd), [Keras](https://github.com/rykov8/ssd_keras), [MXNet](https://github.com/zhreshold/mxnet-ssd), [Tensorflow](https://github.com/balancap/SSD-Tensorflow)

Owner

  • Name: ataraxialab
  • Login: ataraxialab
  • Kind: organization

GitHub Events

Total
Last Year