This benchmark performs object detection using SSD-MobileNet network.
The dataset used for this benchmark is COCO 2017 validation set. You can run bash code/ssd-mobilenet/tensorrt/download_data.sh
to download the dataset.
The input images are in INT8 NCHW or NC/4HW4 format. Please run python3 code/ssd-mobilenet/tensorrt/preprocess_data.py
to run the preprocessing.
The TensorFlow frozen graph ssd_mobilenet_v1_coco_2018_01_28.pb is downloaded from the zenodo link provided by the MLPerf inference repository. We convert the TensorFlow frozen graph to UFF format, and then use TensorRT UFF parser with post-processing steps to convert the UFF model to TensorRT network. Details can be found in SSDMobileNet.py.
You can download the model by running bash code/ssd-mobilenet/tensorrt/download_model.sh
.
The following TensorRT plugin is used to optimize SSDMobileNet benchmark:
NMS_OPT_TRT
: optimizes non-maximum suppression operation The source codes of this plugin can be found in ../../plugin.
To further optimize performance, with minimal impact on detection accuracy, we run the computations in INT8 precision.
On DLA, we replace ReLU6 with ReLU to achieve further performance.
Run the following commands from within the container to run inference through LoadGen:
make run RUN_ARGS="--benchmarks=ssd-mobilenet --scenarios=<SCENARIO> --test_mode=PerformanceOnly"
make run RUN_ARGS="--benchmarks=ssd-mobilenet --scenarios=<SCENARIO> --test_mode=AccuracyOnly"
To run inference through Triton Inference Server and LoadGen:
make run RUN_ARGS="--benchmarks=ssd-mobilenet --scenarios=<SCENARIO> --config_ver=triton --test_mode=PerformanceOnly"
make run RUN_ARGS="--benchmarks=ssd-mobilenet --scenarios=<SCENARIO> --config_ver=triton --test_mode=AccuracyOnly"
The performance and the accuracy results will be printed to stdout, and the LoadGen logs can be found in build/logs
.
Follow these steps to run inference with new weights:
- Replace
build/models/SSDMobileNet/frozen_inference_graph.pb
with new TensorFlow frozen graph. - Run
make calibrate RUN_ARGS="--benchmarks=ssd-mobilenet"
to generate a new calibration cache. - Run inference by
make run RUN_ARGS="--benchmarks=ssd-mobilenet --scenarios=<SCENARIO>"
.
Follow these steps to run inference with new validation dataset:
- Put the validation dataset under
build/data/coco/val2017
and the new annotation data underbuild/data/coco/annotations
. - Modify
data_maps/imagenet/val_map.txt
to contain all the file names of the new validation dataset according to their order in the annotation file. - Preprocess data by
python3 code/ssd-mobilenet/tensorrt/preprocess_data.py --val_only
. - Run inference by
make run RUN_ARGS="--benchmarks=ssd-mobilenet --scenarios=<SCENARIO>"
.
Follow these steps to generate a new calibration cache with new calibration dataset:
- Put the calibration dataset under
build/data/coco/train2017
and the new annotation data underbuild/data/coco/annotations
. - Modify
data_maps/imagenet/cal_map.txt
to contain all the file names of the new calibration dataset. - Preprocess data by
python3 code/ssd-mobilenet/tensorrt/preprocess_data.py --cal_only
. - Run
make calibrate RUN_ARGS="--benchmarks=ssd-mobilenet"
to generate a new calibration cache.