---
# System prepended metadata

title: Dataset and Training

---

# Dataset and Training
https://github.com/dusty-nv/jetson-inference/blob/master/docs/pytorch-ssd.md

## Open Images Web
https://storage.googleapis.com/openimages/web/index.html

### open_images_classes
https://github.com/dusty-nv/pytorch-ssd/blob/master/open_images_classes.txt
382 Person
361 Oven
333 Microwave oven
213 Gas stove
596 Wood-burning stove
125 Coffeemaker
538 Toaster

## Downloading the Data
### The working directory
$ cd jetson-inference/python/training/detection/ssd
$ mkdir ssd/fireAlarm

### Limiting the Amount of Data
In practice, you probably want to keep the total number of images <10K.
open_images_downloader.py options
--stats-only
--max-images

### Show photo numbers
$ python3 open_images_downloader.py --stats-only --class-names "Person,Oven,Microwave oven,Gas stove,Wood-burning stove,Toaster,Coffeemaker" --data=data/fireAlarm

```
-------------------------------------
 'train' set statistics
-------------------------------------
  Image count:  10844
  Bounding box count:  45663
  Bounding box distribution: 
    Person:  45273/45663 = 0.99
    Oven:  104/45663 = 0.00
    Gas stove:  103/45663 = 0.00
    Microwave oven:  84/45663 = 0.00
    Wood-burning stove:  61/45663 = 0.00
    Coffeemaker:  32/45663 = 0.00
    Toaster:  6/45663 = 0.00
 

-------------------------------------
 'validation' set statistics
-------------------------------------
  Image count:  6078
  Bounding box count:  12467
  Bounding box distribution: 
    Person:  12371/12467 = 0.99
    Oven:  21/12467 = 0.00
    Microwave oven:  20/12467 = 0.00
    Wood-burning stove:  19/12467 = 0.00
    Coffeemaker:  18/12467 = 0.00
    Gas stove:  17/12467 = 0.00
    Toaster:  1/12467 = 0.00
 

-------------------------------------
 'test' set statistics
-------------------------------------
  Image count:  18382
  Bounding box count:  38233
  Bounding box distribution: 
    Person:  37997/38233 = 0.99
    Oven:  53/38233 = 0.00
    Coffeemaker:  50/38233 = 0.00
    Gas stove:  49/38233 = 0.00
    Microwave oven:  46/38233 = 0.00
    Wood-burning stove:  34/38233 = 0.00
    Toaster:  4/38233 = 0.00
```
### Downloading with --max-images=2500
$ python3 open_images_downloader.py --max-images=2500 --class-names "Person,Oven,Microwave oven,Gas stove,Wood-burning stove,Coffeemaker,Toaster" --data=data/fireAlarm

## Training the SSD-Mobilenet Model
$ python3 train_ssd.py --data=data/fireAlarm --model-dir=models/fireAlarm --batch-size=4 --epochs=30

## Converting the Model to ONNX
$ python3 onnx_export.py --model-dir=models/fireAlarm

This will save a model called ssd-mobilenet.onnx under jetson-inference/python/training/detection/ssd/models/fireAlarm/



## Running the Live Camera Program
### CSI Camera
$ detectnet --model=models/fireAlarm/ssd-mobilenet.onnx --labels=models/fireAlarm/labels.txt \
          --input-blob=input_0 --output-cvg=scores --output-bbox=boxes csi://0 

### USB Camera
$ detectnet --model=models/fireAlarm/ssd-mobilenet.onnx --labels=models/fireAlarm/labels.txt \
          --input-blob=input_0 --output-cvg=scores --output-bbox=boxes /dev/video0 

### Change resolution to 640x480
$ detectnet --model=models/fireAlarm/ssd-mobilenet.onnx --labels=models/fireAlarm/labels.txt \
          --input-blob=input_0 --output-cvg=scores --output-bbox=boxes \
          --input-width=640 --input-height=480 /dev/video0

### detectnet => python3 detectnet.py
$ cp ~/jetson-inference/build/aarch64/bin/detectnet.py .
$ python3 detectnet.py --model=models/fireAlarm/ssd-mobilenet.onnx --labels=models/fireAlarm/labels.txt \
          --input-blob=input_0 --output-cvg=scores --output-bbox=boxes \
          --input-width=640 --input-height=480 /dev/video0


## Other Datasets
PASCAL VOC Dataset
https://jason-chen-1992.weebly.com/home/pascal-dataset

MS COCO Dataset
https://jason-chen-1992.weebly.com/home/coco-dataset