Back | Next | Contents
Object Detection
In the form fields, specify the following options and paths to the image and label folders under the location where you extracted the aerial dataset:
* Training image folder: `coco/train/images/dog`
* Training label folder: `coco/train/labels/dog`
* Validation image folder: `coco/val/images/dog`
* Validation label folder: `coco/val/labels/dog`
* Pad image (Width x Height): `640 x 640`
* Custom classes: `dontcare, dog`
* Group Name: `MS-COCO`
* Dataset Name: `coco-dog`

Name the dataset whatever you choose and click the `Create` button at the bottom of the page to launch the importing job. Next we'll create the new detection model and begin training it.
### Creating DetectNet Model with DIGITS
When the previous data import job is complete, return to the DIGITS home screen. Select the `Models` tab and choose to create a new `Detection Model` from the drop-down:
Make the following settings in the form:
* Select Dataset: `coco-dog`
* Training epochs: `100`
* Subtract Mean: `none`
* Solver Type: `Adam`
* Base learning rate: `2.5e-05`
* Select `Show advanced learning options`
* Policy: `Exponential Decay`
* Gamma: `0.99`
#### Selecting DetectNet Batch Size
DetectNet's network default batch size of 10 consumes up to 12GB GPU memory during training. However by using the `Batch Accumulation` field, you can also train DetectNet on a GPU with less than 12GB memory. See the table below depending on the amount of GPU memory available in your DIGITS server:
| GPU Memory | Batch Size | Batch Accumulation |
| -------------- |:-------------------------:|:-------------------:|
| 4GB | 2 | 5 |
| 8GB | 5 | 2 |
| 12GB or larger | `[network defaults]` (10) | Leave blank (1) |
If you're training on a card with 12GB of memory or more, leave the `Batch Size` as the default and leave the `Batch Accumulation` blank. For GPUs with less memory, use the settings from above.
#### Specifying the DetectNet Prototxt
In the network area select the `Custom Network` tab and then copy/paste the contents of [`detectnet.prototxt`](../data/networks/detectnet.prototxt)

The DetectNet prototxt is located at [`data/networks/detectnet.prototxt`](https://github.com/dusty-nv/jetson-inference/blob/master/data/networks/detectnet.prototxt) in the repo.
#### Training the Model with Pretrained Googlenet
Since DetectNet is derived from Googlenet, it is strongly recommended to use pre-trained weights from Googlenet as this will help speed up and stabilize training significantly. Download the Googlenet model from [here](http://dl.caffe.berkeleyvision.org/bvlc_googlenet.caffemodel) or by running the following command from your DIGITS server:
```bash
wget http://dl.caffe.berkeleyvision.org/bvlc_googlenet.caffemodel
```
Then specify the path to your Googlenet under the `Pretrained Model` field.
Select a GPU to train on and set a name and group for the model:
* Group Name `MS-COCO`
* Model Name `DetectNet-COCO-Dog`
Finally, click the `Create` button at the bottom to begin training.

### Testing DetectNet Model Inference in DIGITS
Leave the training job to run for a while, say 50 epochs, until the mAP (`Mean Average Precision`) plot begins to increase. Note that due to the way mAP is calculated by the DetectNet loss function, the scale of mAP isn't necessarily 0-100, and even an mAP between 5 and 10 may indicate the model is functional. With the size of the example COCO datasets we are using, it should take a couple hours training on a recent GPU before all 100 epochs are complete.

At this point, we can try testing our new model's inference on some example images in DIGITS. On the same page as the plot above, scroll down under the `Trained Models` section. Set the `Visualization Model` to *Bounding Boxes* and under `Test a Single Image`, select an image to try (for example, `/coco/val/images/dog/000074.png`):
Press the `Test One` button and you should see a page similar to:

Next, we will deploy our DetectNet model to Jetson and run the inference there.
##
Next | Downloading the Detection Model to Jetson
Back | Loading Custom Models on Jetson
© 2016-2019 NVIDIA | Table of Contents