Back | Next | Contents
Object Detection
``` bash
# Download test video
wget https://nvidia.box.com/shared/static/veuuimq6pwvd62p9fresqhrrmfqz0e2f.mp4 -O pedestrians.mp4
# C++
$ detectnet --model=peoplenet pedestrians.mp4 pedestrians_peoplenet.mp4
# Python
$ detectnet.py --model=peoplenet pedestrians.mp4 pedestrians_peoplenet.mp4
```
You can also adjust the `--confidence` and `--clustering` thresholds - these TAO models seem not introduce too many false positives with lower thresholds due to their increased accuracy. The [Flask webapp](webrtc-flask.md) is a convenient tool for playing around with these settings interactively.
### DashCamNet
Like PeopleNet, [DashCamNet](https://catalog.ngc.nvidia.com/orgs/nvidia/teams/tao/models/dashcamnet) is a 960x544 detector based on DetectNet_v2 and ResNet-34. It's intended use is for detecting people and vehicles from street-level viewpoints and first-person perspectives. TrafficCamNet is similar, for imagery taken from a higher vantage point.
``` bash
# C++
$ detectnet --model=dashcamnet input.mp4 output.mp4
# Python
$ detectnet.py --model=dashcamnet input.mp4 output.mp4
```
> **note**: you can run this with any input/output from the [Camera Streaming and Multimedia](aux-streaming.md) page
### FaceDetect
[FaceDetect](https://catalog.ngc.nvidia.com/orgs/nvidia/teams/tao/models/facenet) is a TAO model for just detecting faces. It was trained with up to ~85% accuracy on a dataset with more than 1.8M samples taken from a variety of camera angles. It has a resolution of 736x416 and uses DetectNet_v2 with a ResNet-18 backbone.
``` bash
# C++
$ detectnet --model=facedetect "images/humans_*.jpg" images/test/facedetect_humans_%i.jpg
# Python
$ detectnet.py --model=facedetect "images/humans_*.jpg" images/test/facedetect_humans_%i.jpg
```
### Importing Your Own TAO Detection Models
Although jetson-inference can automatically download, convert, and load the pre-trained TAO detection models above, you may wish to use a different version of those models or your own DetectNet_v2 model that you trained or fine-tuned using TAO. To do that, copy your trained ETLT model to your Jetson, along with the appropriate version of the [`tao-converter`](https://catalog.ngc.nvidia.com/orgs/nvidia/teams/tao/resources/tao-converter) tool. Then depending on your model's configuration (the details of which are typically found on the model card), you can run a script like below to generate the TensorRT engine from the ETLT:
``` bash
# model config
MODEL_DIR="peoplenet_deployable_quantized_v2.6.1"
MODEL_INPUT="$MODEL_DIR/resnet34_peoplenet_int8.etlt"
MODEL_OUTPUT="$MODEL_INPUT.engine"
INPUT_DIMS="3,544,960"
OUTPUT_LAYERS="output_bbox/BiasAdd,output_cov/Sigmoid"
MAX_BATCH_SIZE="1"
WORKSPACE="4294967296" # 4GB (default)
PRECISION="int8" # fp32, fp16, int8
CALIBRATION="$MODEL_DIR/resnet34_peoplenet_int8.txt"
ENCRYPTION_KEY="tlt_encode"
# generate TensorRT engine
tao-converter \
-k $ENCRYPTION_KEY \
-d $INPUT_DIMS \
-o $OUTPUT_LAYERS \
-m $MAX_BATCH_SIZE \
-w $WORKSPACE \
-t $PRECISION \
-c $CALIBRATION \
-e $MODEL_OUTPUT \
$MODEL_INPUT
```
After converting it, you can load it with detectnet/detectnet.py like so:
``` bash
$ detectnet \
--model=$MODEL_DIR/resnet34_peoplenet_int8.etlt.engine \
--labels=$MODEL_DIR/labels.txt \
--input-blob=input_1 \
--output-cvg=output_cov/Sigmoid \
--output-bbox=output_bbox/BiasAdd \
input.mp4 output.mp4
```
> **note**: only TAO DetectNet_v2 models are currently supported in jetson-inference, as it is setup for that network's pre/post-processing
In your own applications, you can also load them directly from [C++](https://rawgit.com/dusty-nv/jetson-inference/master/docs/html/classdetectNet.html#a9981735c38d2cb97205aa9e255ab4a0e) or [Python](https://github.com/dusty-nv/jetson-inference/blob/89a9bbe8812ec8a142910ae55e9a6c25dbdb9841/python/examples/detectnet.py#L57) by using the extended form of the detectNet API.
Next | Object Tracking on Video
Back | Coding Your Own Object Detection Program
© 2016-2023 NVIDIA | Table of Contents