VehicleTypeNet classifies car image into 6 vehicle types:
This model is ready for commercial use.
Architecture Type: Convolution Neural Network (CNN)
Network Architecture: ResNet18
This is a classification model with a Resnet18 backbone.
Input Type(s): Images
Input Format(s): Red, Green, Blue (RGB)
Input Parameters: 4D
Other Properties Related to Input: RGB Resolution: 224 X 224 X 3 (W x H x C) Channel Ordering of the Input: NCHW, where N = Batch Size, C = number of channels (3), H = Height of images (224), W = Width of the images (224) Input scale: None Mean subtraction: [103.939, 116.779, 123.68]; No minimum bit depth, alpha, or gamma.
Output Type(s): Label(s)
Output Format: Label: Text String(s)
Other Properties Related to Output: Category Label(s): coupe, sedan, SUV, van, large vehicle, truck
Runtime Engine(s):
Supported Hardware Architecture Compatibility:
Preferred Operating System(s):
VehicleTypeNet was trained on a proprietary dataset with more than 60K car images. The training dataset contains car crops from a mix of camera heights, camera angles, field-of view (FOV) and occlusions.
60,000 images from an internal, private dataset of cars with a mix of camera heights, camera angles, field-of view (FOV) and occlusions represented.
3000 images from an internal, private dataset of cars with a mix of camera heights, camera angles, field-of view (FOV) and occlusions represented.
The KPI for the evaluation data are reported in the table below. Model is evaluated based on Top-1 accuracy.
Model | VehicleTypeNet |
---|---|
Content | Top1 Accuracy |
Evaluation Set | 88% |
The inference is run on the provided pruned model at INT8 precision. On Jetson Nano, FP16 precision is used. The inference performance is run using trtexec
on Jetson Nano, AGX Xavier, Xavier NX and NVIDIA T4 GPU. The Jetson devices are running at Max-N configuration for maximum GPU frequency. The performance shown here is the inference only performance. The end-to-end performance with streaming video data might slightly vary depending on other bottlenecks in the hardware and software.
This model needs to be used with NVIDIA Hardware and Software. For Hardware, the model can run on any NVIDIA GPU including NVIDIA Jetson devices. This model can only be used with Train Adapt Optimize (TAO) Toolkit, DeepStream SDK or TensorRT.
There are two flavors of the model:
The unpruned
model is intended for training using TAO Toolkit and the user's own dataset. This can provide high fidelity models that are adapted to the use case. The Jupyter notebook available as a part of TAO container can be used to re-train.
The pruned
model is intended for efficient deployment on the edge using DeepStream SDK or TensorRT. This model accepts 224x224x3
dimension input tensors and outputs a 1x6
class confidence tensor. DeepStream provides a toolkit to create efficient video analytic pipelines to capture, decode, and pre-process the data before running inference. DeepStream provides a toolkit to attach the classification model to any primary detector. The primary detector will detect the object and crop the object before sending to secondary classifiers.
The unpruned
and pruned
models are encrypted and will only operate with the following key:
tlt_encode
Please make sure to use this as the key for all TAO commands that require a model load key.
In order, to use this model as a pretrained weights for transfer learning, please use the below mentioned snippet as template for the model_config
and traning_config
component of the experiment spec file to train a Classification model. For more information on the experiment spec file, please refer to the TAO Toolkit User Guide.
model_config {
arch: "resnet"
n_layers: 18
use_bias: True
use_batch_norm: True
all_projections: True
use_pooling: False
freeze_bn: False
freeze_blocks: 0
freeze_blocks: 1
input_image_size: "3,224,224"
}
training_config{
train_dataset_path: "/path/to/your/train/data"
val_dataset_path: "/path/to/your/val/data"
pretrained_model_path: "/path/to/your/pretrained/model"
optimizer {
sgd {
lr: 0.01
decay: 0.0
momentum: 0.9
nesterov: False
}
}
batch_size_per_gpu: 256
n_epochs: 80
n_workers: 16
reg_config {
type: "L2"
scope: "Conv2D,Dense"
weight_decay: 0.00005
}
}
To create the entire end-to-end video analytic application, deploy this model with DeepStream SDK. DeepStream SDK is a streaming analytic toolkit to accelerate building AI-based video analytic applications. DeepStream supports direct integration of this model into the deepstream sample app.
To deploy this model with DeepStream 5.1, please follow the instructions below:
Run the default deepstream-app
included in the DeepStream docker, by simply executing the commands below.
## Download Model:
mkdir -p $HOME/vehicletypenet && \
wget https://api.ngc.nvidia.com/v2/models/nvidia/tao/vehicletypenet/versions/pruned_v1.0/files/resnet18_vehicletypenet_pruned.etlt\
-O $HOME/vehicletypenet/resnet18_vehicletypenet_pruned.etlt && \
wget https://api.ngc.nvidia.com/v2/models/nvidia/tao/vehicletypenet/versions/pruned_v1.0/files/vehicletypenet_int8.txt \
-O $HOME/vehicletypenet/vehicletypenet_int8.txt
## Run Application
xhost +
sudo docker run --gpus all -it --rm -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY -v $HOME:/opt/nvidia/deepstream/deepstream-5.1/samples/models/tlt_pretrained_models \
-w /opt/nvidia/deepstream/deepstream-5.1/samples/configs/tlt_pretrained_models nvcr.io/nvidia/deepstream:5.1-21.02-samples \
deepstream-app -c deepstream_app_source1_dashcamnet_vehiclemakenet_vehicletypenet.txt
Install deepstream on your local host and run the deepstream-app.
To deploy this model with DeepStream, please follow the instructions below: Download and install DeepStream SDK. The installation instructions for DeepStream are provided in DeepStream development guide. The config files for the purpose-built models are located in:
/opt/nvidia/deepstream/deepstream-5.1/samples/configs/tlt_pretrained_models
/opt/nvidia/deepstream
is the default DeepStream installation directory. This path will be different if you are installing in a different directory.
You will need multiple config files and 1 label file. These files are provided in the tlt_pretrained_models
directory.
deepstream_app_source1_dashcamnet_vehiclemakenet_vehicletypenet.txt - Main config file for DeepStream app
config_infer_primary_dashcamnet.txt - File to configure primary detection (DashCamNet)
config_infer_secondary_vehicletypenet.txt - File to configure Vehicle type classifier
labels_dashcamnet.txt - Label file with 3 for object detection
labels_vehiclemakenet.txt - Label file with 6 classes of Vehicle type
Note: The deepstream_app_source1_dashcamnet_vehiclemakenet_vehicletypenet.txt
configures 3 models: DashCamNet as primary detector, and VehicleMakeNet and VehicleTypeNet as secondary classifiers. The classification models are typically used after initial object detection.
Key Parameters in config_infer_secondary_vehicletypenet.txt
tlt-model-key
tlt-encoded-model
labelfile-path
int8-calib-file
input-dims
num-detected-classes
Run deepstream-app
:
deepstream-app -c deepstream_app_source1_dashcamnet_vehiclemakenet_vehicletypenet.txt
Documentation to deploy with DeepStream is provided in "Deploying to DeepStream" chapter of TAO User Guide.
NVIDIA VehicleTypeNet model classifies the type of the car from a given crop. Training and evaluation dataset mostly consists of North American content. An ideal training and evaluation dataset would additionally include content from other geographies as well.
NVIDIA’s platforms and application frameworks enable developers to build a wide array of AI applications. Consider potential algorithmic bias when choosing or creating the models being deployed. Work with the model’s developer to ensure that it meets the requirements for the relevant industry and use case; that the necessary instruction and documentation are provided to understand error rates, confidence intervals, and results; and that the model is being used under the conditions and in the manner intended.