All Projects → NVIDIA → Retinanet Examples

NVIDIA / Retinanet Examples

Licence: bsd-3-clause
Fast and accurate object detection with end-to-end GPU optimization

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Retinanet Examples

Keras Yolov3 Mobilenet
I transfer the backend of yolov3 into Mobilenetv1,VGG16,ResNet101 and ResNeXt101
Stars: ✭ 552 (-12.52%)
Mutual labels:  object-detection
Yolov3
Keras implementation of yolo v3 object detection.
Stars: ✭ 585 (-7.29%)
Mutual labels:  object-detection
Android Yolo
Real-time object detection on Android using the YOLO network with TensorFlow
Stars: ✭ 604 (-4.28%)
Mutual labels:  object-detection
Efficientdet
(Pretrained weights provided) EfficientDet: Scalable and Efficient Object Detection implementation by Signatrix GmbH
Stars: ✭ 565 (-10.46%)
Mutual labels:  object-detection
Ai Basketball Analysis
🏀🤖🏀 AI web app and API to analyze basketball shots and shooting pose.
Stars: ✭ 582 (-7.77%)
Mutual labels:  object-detection
Smart construction
Head Person Helmet Detection on Construction Sites,基于目标检测工地安全帽和禁入危险区域识别系统,🚀😆附 YOLOv5 训练自己的数据集超详细教程🚀😆2021.3新增可视化界面❗❗
Stars: ✭ 586 (-7.13%)
Mutual labels:  object-detection
Mmdetection Annotated
mmdetection源码注释
Stars: ✭ 544 (-13.79%)
Mutual labels:  object-detection
Gaussian yolov3
Gaussian YOLOv3: An Accurate and Fast Object Detector Using Localization Uncertainty for Autonomous Driving (ICCV, 2019)
Stars: ✭ 622 (-1.43%)
Mutual labels:  object-detection
Vehicle counting tensorflow
🚘 "MORE THAN VEHICLE COUNTING!" This project provides prediction for speed, color and size of the vehicles with TensorFlow Object Counting API.
Stars: ✭ 582 (-7.77%)
Mutual labels:  object-detection
Simplecvreproduction
Reproduce simple cv project including attention module, classification, object detection, segmentation, keypoint detection, tracking 😄 etc.
Stars: ✭ 602 (-4.6%)
Mutual labels:  object-detection
Detectorch
Detectorch - detectron for PyTorch
Stars: ✭ 566 (-10.3%)
Mutual labels:  object-detection
Centernet2
Two-stage CenterNet
Stars: ✭ 496 (-21.39%)
Mutual labels:  object-detection
Photonix
This is a new web-based photo management application. Run it on your home server and it will let you find the right photo from your collection on any device. Smart filtering is made possible by object recognition, location awareness, color analysis and other ML algorithms.
Stars: ✭ 592 (-6.18%)
Mutual labels:  object-detection
Cv paperdaily
CV 论文笔记
Stars: ✭ 555 (-12.04%)
Mutual labels:  object-detection
Weighted Boxes Fusion
Set of methods to ensemble boxes from different object detection models, including implementation of "Weighted boxes fusion (WBF)" method.
Stars: ✭ 610 (-3.33%)
Mutual labels:  object-detection
Curve Text Detector
This repository provides train&test code, dataset, det.&rec. annotation, evaluation script, annotation tool, and ranking.
Stars: ✭ 551 (-12.68%)
Mutual labels:  object-detection
Deep Learning For Hackers
Machine Learning tutorials with TensorFlow 2 and Keras in Python (Jupyter notebooks included) - (LSTMs, Hyperameter tuning, Data preprocessing, Bias-variance tradeoff, Anomaly Detection, Autoencoders, Time Series Forecasting, Object Detection, Sentiment Analysis, Intent Recognition with BERT)
Stars: ✭ 586 (-7.13%)
Mutual labels:  object-detection
Kl Loss
Bounding Box Regression with Uncertainty for Accurate Object Detection (CVPR'19)
Stars: ✭ 624 (-1.11%)
Mutual labels:  object-detection
Tf trt models
TensorFlow models accelerated with NVIDIA TensorRT
Stars: ✭ 621 (-1.58%)
Mutual labels:  object-detection
Centermask2
Real-time Anchor-Free Instance Segmentation, in CVPR 2020
Stars: ✭ 596 (-5.55%)
Mutual labels:  object-detection

NVIDIA Object Detection Toolkit (ODTK)

Fast and accurate single stage object detection with end-to-end GPU optimization.

Description

ODTK is a single shot object detector with various backbones and detection heads. This allows performance/accuracy trade-offs.

It is optimized for end-to-end GPU processing using:

  • The PyTorch deep learning framework with ONNX support
  • NVIDIA Apex for mixed precision and distributed training
  • NVIDIA DALI for optimized data pre-processing
  • NVIDIA TensorRT for high-performance inference
  • NVIDIA DeepStream for optimized real-time video streams support

Rotated bounding box detections

This repo now supports rotated bounding box detections. See rotated detections training and rotated detections inference documents for more information on how to use the --rotated-bbox command.

Bounding box annotations are described by [x, y, w, h, theta].

Performance

The detection pipeline allows the user to select a specific backbone depending on the latency-accuracy trade-off preferred.

ODTK RetinaNet model accuracy and inference latency & FPS (frames per seconds) for COCO 2017 (train/val) after full training schedule. Inference results include bounding boxes post-processing for a batch size of 1. Inference measured at --resize 800 using --with-dali on a FP16 TensorRT engine.

Backbone mAP @[IoU=0.50:0.95] Training Time on DGX1v Inference latency FP16 on V100 Inference latency INT8 on T4
ResNet18FPN 0.318 5 hrs 14 ms; 71 FPS 18 ms; 56 FPS
MobileNetV2FPN 0.333 14 ms; 74 FPS 18 ms; 56 FPS
ResNet34FPN 0.343 6 hrs 16 ms; 64 FPS 20 ms; 50 FPS
ResNet50FPN 0.358 7 hrs 18 ms; 56 FPS 22 ms; 45 FPS
ResNet101FPN 0.376 10 hrs 22 ms; 46 FPS 27 ms; 37 FPS
ResNet152FPN 0.393 12 hrs 26 ms; 38 FPS 33 ms; 31 FPS

Installation

For best performance, use the latest PyTorch NGC docker container. Clone this repository, build and run your own image:

git clone https://github.com/nvidia/retinanet-examples
docker build -t odtk:latest retinanet-examples/
docker run --gpus all --rm --ipc=host -it odtk:latest

Usage

Training, inference, evaluation and model export can be done through the odtk utility. For more details, including a list of parameters, please refer to the TRAINING and INFERENCE documentation.

Training

Train a detection model on COCO 2017 from pre-trained backbone:

odtk train retinanet_rn50fpn.pth --backbone ResNet50FPN \
    --images /coco/images/train2017/ --annotations /coco/annotations/instances_train2017.json \
    --val-images /coco/images/val2017/ --val-annotations /coco/annotations/instances_val2017.json

Fine Tuning

Fine-tune a pre-trained model on your dataset. In the example below we use Pascal VOC with JSON annotations:

odtk train model_mydataset.pth --backbone ResNet50FPN \
    --fine-tune retinanet_rn50fpn.pth \
    --classes 20 --iters 10000 --val-iters 1000 --lr 0.0005 \
    --resize 512 --jitter 480 640 --images /voc/JPEGImages/ \
    --annotations /voc/pascal_train2012.json --val-annotations /voc/pascal_val2012.json

Note: the shorter side of the input images will be resized to resize as long as the longer side doesn't get larger than max-size. During training, the images will be randomly randomly resized to a new size within the jitter range.

Inference

Evaluate your detection model on COCO 2017:

odtk infer retinanet_rn50fpn.pth --images /coco/images/val2017/ --annotations /coco/annotations/instances_val2017.json

Run inference on your dataset:

odtk infer retinanet_rn50fpn.pth --images /dataset/val --output detections.json

Optimized Inference with TensorRT

For faster inference, export the detection model to an optimized FP16 TensorRT engine:

odtk export model.pth engine.plan

Evaluate the model with TensorRT backend on COCO 2017:

odtk infer engine.plan --images /coco/images/val2017/ --annotations /coco/annotations/instances_val2017.json

INT8 Inference with TensorRT

For even faster inference, do INT8 calibration to create an optimized INT8 TensorRT engine:

odtk export model.pth engine.plan --int8 --calibration-images /coco/images/val2017/

This will create an INT8CalibrationTable file that can be used to create INT8 TensorRT engines for the same model later on without needing to do calibration.

Or create an optimized INT8 TensorRT engine using a cached calibration table:

odtk export model.pth engine.plan --int8 --calibration-table /path/to/INT8CalibrationTable

Datasets

RetinaNet supports annotations in the COCO JSON format. When converting the annotations from your own dataset into JSON, the following entries are required:

{
    "images": [{
        "id" : int,
        "file_name" : str
    }],
    "annotations": [{
        "id" : int,
        "image_id" : int, 
        "category_id" : int,
        "bbox" : [x, y, w, h]   # all floats
        "area": float           # w * h. Required for validation scores
        "iscrowd": 0            # Required for validation scores
    }],
    "categories": [{
        "id" : int
    ]}
}

If using the --rotated-bbox flag for rotated detections, add an additional float theta to the annotations. To get validation scores you also need to fill the segmentation section.

        "bbox" : [x, y, w, h, theta]    # all floats, where theta is measured in radians anti-clockwise from the x-axis.
        "segmentation" : [[x1, y1, x2, y2, x3, y3, x4, y4]]
                                        # Required for validation scores.

Disclaimer

This is a research project, not an official NVIDIA product.

Jetpack compatibility

This branch uses TensorRT 7. If you are training and inferring models using PyTorch, or are creating TensorRT engines on Tesla GPUs (eg V100, T4), then you should use this branch.

If you wish to deploy your model to a Jetson device (eg - Jetson AGX Xavier) running Jetpack version 4.3, then you should use the 19.10 branch of this repo.

References

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].