DINO<T>

Models & Types · AiDotNet.ComputerVision.Detection.ObjectDetection.DETR

DINO (DETR with Improved deNoising anchOr boxes).

Inheritance: ModelBase<T, Tensor<T>, Tensor<T>> → VisionTaskModelBase<T> → ObjectDetectorBase<T> → DINO<T>

Implements: IDetectionTrainingModel<T>

For Beginners

DINO is an end-to-end detector: it predicts a fixed set of boxes and learns which of them are objects, so it needs no anchors or non-maximum suppression. It trains faster and more accurately than the original DETR through three ideas. Contrastive denoising teaches the decoder to repair noised copies of the real boxes and to reject harder negatives. Mixed query selection starts the queries from the encoder’s best positions. “Look forward twice” lets each layer’s box correction improve the layer before it.

How It Works

The architecture follows the reference implementation (IDEA-Research/DINO) at DINO-4scale:

  • The backbone’s C3-C5 (C2-C5 at five scales) plus an extra stride-2 level are projected to 256

channels with GroupNorm.

  • Six deformable encoder layers (MultiScaleDeformableAttention).
  • Two-stage proposals: the encoder’s top-K positions are the anchors, and the content queries

are learnable.

  • Six decoder layers (self-attention, deformable cross-attention, FFN) with iterative box

refinement.

  • Shared sigmoid class and box heads.

The training objective is the reference’s: focal + L1 + GIoU with Hungarian matching on the final layer, on each intermediate layer and on the encoder proposals. On top of that come the contrastive denoising losses of every layer.

Reference: Zhang et al., “DINO: DETR with Improved DeNoising Anchor Boxes for End-to-End Object Detection”, ICLR 2023

Constructors

Constructor Summary
DINO(ObjectDetectionOptions<T> options) Creates DINO.

Properties

Property Summary
string Name { get; }

Methods

Method Summary
DetectionResult<T> Detect(Tensor<T> image, double confidenceThreshold, double nmsThreshold)
Task LoadWeightsAsync(string pathOrUrl, CancellationToken cancellationToken)
double EffectiveNmsThreshold(double requested)
void SaveWeights(string path)
void Train(Tensor<T> input, Tensor<T> expectedOutput)
void TrainDetections(Tensor<T> input, DetectionTrainingBatch<T> targets)