NGC | Catalog
CatalogModelsNV-DINOv2 Classification Model

NV-DINOv2 Classification Model

Logo for NV-DINOv2 Classification Model
Associated Products
Features
Description
TAO Commercial Pretrained NV-DINOv2 Classification Model
Publisher
NVIDIA
Latest Version
trainable_v1.1
Modified
November 7, 2023
Size
1.05 GB

TAO Commercial Pretrained NV-Dinov2 Classification Model

What is Train Adapt Optimize (TAO) Toolkit?

Train Adapt Optimize (TAO) Toolkit is a Python-based AI toolkit for customizing purpose-built pre-trained AI models with your own data. TAO Toolkit adapts popular network architectures and backbones to your data, allowing you to train, fine tune, prune, and export highly optimized and accurate AI models for edge deployment.

The pre-trained models accelerate the AI training process and reduce costs associated with large scale data collection, labeling, and training models from scratch. Transfer learning with pre-trained models can be used for AI applications in smart cities, retail, healthcare, industrial inspection and more.

Build end-to-end services and solutions for transforming pixels and sensor data to actionable insights using the TAO DeepStream SDK and TensorRT. These models are suitable for object detection, classification, and segmentation.

Model Overview

Image Classification is a popular computer vision technique in which an image is classified into one of the designated classes based on the image features. This model card contains pretrained weights of most of the popular classification models. These weights that may be used as a starting point with the classification app in Train Adapt Optimize (TAO) Toolkit to facilitate transfer learning.

Model Architecture

NV-Dinov2 is a visual foundational model trained on NVIDIA proprietary large scale dataset. Dinov2 is a self-supervised learning method that uses a combination of two SSL techniques : DINO and iBOT. These models could greatly simplify the use of images in any system by producing all purpose visual features, i.e., features that work across image distributions and tasks without finetuning. Trained on large curated datasets, our model has learnt robust fine-grained representation useful for localization and classification tasks. This model can be used as a foundation model for a variety of downstream tasks with few labeled examples. For more details on the method please refer: Dinov2.

Training

This model was trained using our implementation of DINOV2 on NVIDIA-commercial dataset.

Training Data

NV-Dinov2 was trained on NVIDIA proprietary collected data that are of commercial license.

Performance

Evaluation Data

We have tested the Dinov2 models on the ImageNet1K validation dataset.

Methodology and KPI

The key performance indicator is the accuracy, following the standard evaluation protocol for image classification. The KPI for the evaluation data are reported below.

model top-1 accuracy
ImageNet validation 79.9

Real-time Inference Performance

The inference is run on the provided unpruned model at FP16 precision. The inference performance is run using trtexec on Jetson AGX Xavier, Xavier NX, Orin, Orin NX and NVIDIA T4, and Ampere GPUs. 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.

The inference is run on the provided unpruned model at FP16 precision. The inference performance is run using trtexec. The end-to-end performance with streaming video data might slightly vary depending on other bottlenecks in the hardware and software.

NVDinoV2 (224x224 resolution performance)

Platform BS FPS
Orin NX 16GB 16 31.55
AGX Orin 64GB 16 81.41
A2 16 72.7
T4 4 110.3
A30 16 461.0
L4 4 275.0
L40 8 579.0
A100 32 1031.0
H100 64 2500.6

How to Use This Model

These models need to be used with NVIDIA Hardware and Software. For Hardware, the models can run on any NVIDIA GPU including NVIDIA Jetson devices. These models can only be used with Train Adapt Optimize (TAO) Toolkit, DeepStream SDK or TensorRT.

The primary use case for these models is classifying objects in a color (RGB) image. The model can be used to classify objects from photos and videos by using appropriate video or image decoding and pre-processing.

These models are intended for training and fine-tune using TAO Toolkit and user datasets for image classification. High-fidelity models can be trained to the new use cases. A Jupyter notebook is available as a part of the TAO container and can be used to re-train.

The models are also intended for easy edge deployment using DeepStream SDK or TensorRT. DeepStream provides the facilities to create efficient video analytic pipelines to capture, decode, and pre-process the data before running inference.

Input

  • B X 3 X 224 X 224 (B C H W) - B X 3 X 518 X 518 (B C H W)

Output

Output is an embedding and can be used as pre-trained backbone weights for different downstream tasks sucha s classification, detection and segmentation.

Instructions to Use Pretrained Models with TAO

To use these models as pretrained weights for transfer learning, please use the snippet below as template for the model and train component of the experiment spec file to train a Dinov2 Classification model. For more information on the experiment spec file, please refer to the TAO Toolkit User Guide.

model:
  init_cfg:
    checkpoint: None
  backbone:
    type: vit_large_patch14_dinov2_swiglu
    pretrained: /path/to/NV_DINOV2_518.ckpt
    freeze: True
  head:
    type: LinearClsHead

In order to change the input resolution for fine-tuning between 224 to 518, change the size in the RandomResizedCrop field under dataset config as shown below:

dataset:
  data:
    samples_per_gpu: 512
    workers_per_gpu: 8
    train:
      data_prefix: ???
      pipeline: # Augmentations alone
        - type: RandomResizedCrop
          size: 224
        - type: RandomFlip
          flip_prob: 0.5
          direction: "horizontal"
        - type: ColorJitter
          brightness: 0.4
          contrast: 0.4
          saturation: 0.4
    val:
      data_prefix: ???
    test:
      data_prefix: ???

Instructions to Deploy These Models with DeepStream

Documentation to deploy with DeepStream is provided in "Deploying to DeepStream" chapter of TAO User Guide. Notice that due to Deepstream SDK 6.2 update, the instructions below can only derive PGIE output, so you are not able to get Retail Object Recgnition outputs from the Deepstream SDK 6.2

Limitations

The model was trained on 130M images using the DINOV2 SSL. The model may not perform well on different data distributions, so we recommend conducting further finetuning on the target domain to get higher accuracy.

Model Versions

  • NV-DinoV2-518-V0_trainable - 130M internal dataset pre-trained model at 518 resolution which can be used for fine-tuning.
  • NV-DinoV2-518-V0_deployable - 130M internal dataset deployable model at 518 resolution.

Reference

Citations

  • Oquab, Maxime, et al. "Dinov2: Learning robust visual features without supervision." arXiv preprint arXiv:2304.07193 (2023).

Using TAO Pre-trained Models

License

The licenses to use this model is covered by the Model EULA. By downloading the unpruned or pruned version of the model, you accept the terms and conditions of these licenses

Technical blogs

Suggested reading

Ethical Considerations

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 developers to ensure that it meets the requirements for the relevant industry and use case, that the necessary instructions 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.