Class RFDetrSegmentation

Namespace
NT2I.ONNX.Architectures.RFDetr
Assembly
NT2I.ONNX.Architectures.dll

Architecture de haut niveau pour les modèles de segmentation d'instance RF-DETR.

Étend RFDetrDetection avec la prise en charge d'un troisième tenseur de sortie : masks [B, N, H', W'] — masques basse résolution à upsampler par image.

Convention des tenseurs de sortie (à vérifier avec Netron sur le modèle exporté) :

  • Index 0 : boxes [B, N, 4].
  • Index 1 : logits [B, N, C].
  • Index 2 : masks [B, N, H', W'].

Le pré-traitement est identique à RFDetrDetection (ImageNet + StretchResize), donc un seul kernel CUDA est exécuté en mode Hub même si les deux variants sont enregistrés simultanément.

public class RFDetrSegmentation : RFDetrDetection, IImageConsumingArchitecture, IDisposable
Inheritance
RFDetrSegmentation
Implements
Inherited Members

Constructors

RFDetrSegmentation()

public RFDetrSegmentation()

RFDetrSegmentation(IOnnxSessionOptions, IRFDetrDetectionPreprocessor, IRFDetrDetectionPostprocessor, IRFDetrSegmentationPostprocessor)

Constructeur combiné : initialise directement.

public RFDetrSegmentation(IOnnxSessionOptions options, IRFDetrDetectionPreprocessor preprocessor, IRFDetrDetectionPostprocessor detectionPostprocessor, IRFDetrSegmentationPostprocessor segmentationPostprocessor)

Parameters

options IOnnxSessionOptions
preprocessor IRFDetrDetectionPreprocessor
detectionPostprocessor IRFDetrDetectionPostprocessor
segmentationPostprocessor IRFDetrSegmentationPostprocessor

Methods

Dispose()

public void Dispose()

GetOutputSegmentation(float, int, int, int, bool)

Post-traite les trois sorties du modèle et retourne les segmentations d'instance.

public IEnumerable<IEnumerable<IInstanceSegmentation>> GetOutputSegmentation(float confidenceThreshold, int boxesOutputIndex = 0, int logitsOutputIndex = 1, int masksOutputIndex = 2, bool normalizeCoordinates = false)

Parameters

confidenceThreshold float

Seuil de confiance global.

boxesOutputIndex int

Index du tenseur boxes (défaut = 0).

logitsOutputIndex int

Index du tenseur logits (défaut = 1).

masksOutputIndex int

Index du tenseur masks (défaut = 2).

normalizeCoordinates bool

Si true, retourne des coordonnées normalisées.

Returns

IEnumerable<IEnumerable<IInstanceSegmentation>>

Pour chaque image du batch : une collection de IInstanceSegmentation (boîte + masque float [0, 1] à la résolution originale). Seuiller chaque valeur à 0.5 pour obtenir un masque binaire.

GetOutputSegmentation(float[], int, int, int, bool)

Post-traite les trois sorties du modèle et retourne les segmentations d'instance.

public IEnumerable<IEnumerable<IInstanceSegmentation>> GetOutputSegmentation(float[] classConfidenceThresholds, int boxesOutputIndex = 0, int logitsOutputIndex = 1, int masksOutputIndex = 2, bool normalizeCoordinates = false)

Parameters

classConfidenceThresholds float[]

Seuils de confiance par classe.

boxesOutputIndex int

Index du tenseur boxes (défaut = 0).

logitsOutputIndex int

Index du tenseur logits (défaut = 1).

masksOutputIndex int

Index du tenseur masks (défaut = 2).

normalizeCoordinates bool

Si true, retourne des coordonnées normalisées.

Returns

IEnumerable<IEnumerable<IInstanceSegmentation>>

Initialize(IOnnxSessionOptions, IRFDetrDetectionPreprocessor, IRFDetrDetectionPostprocessor, IRFDetrSegmentationPostprocessor)

Initialise le moteur RF-DETR Segmentation.

public void Initialize(IOnnxSessionOptions options, IRFDetrDetectionPreprocessor preprocessor, IRFDetrDetectionPostprocessor detectionPostprocessor, IRFDetrSegmentationPostprocessor segmentationPostprocessor)

Parameters

options IOnnxSessionOptions
preprocessor IRFDetrDetectionPreprocessor
detectionPostprocessor IRFDetrDetectionPostprocessor
segmentationPostprocessor IRFDetrSegmentationPostprocessor

InitializeAsync(IOnnxSessionOptions, IRFDetrDetectionPreprocessor, IRFDetrDetectionPostprocessor, IRFDetrSegmentationPostprocessor, CancellationToken)

Initialise le moteur RF-DETR Segmentation de manière asynchrone.

public Task InitializeAsync(IOnnxSessionOptions options, IRFDetrDetectionPreprocessor preprocessor, IRFDetrDetectionPostprocessor detectionPostprocessor, IRFDetrSegmentationPostprocessor segmentationPostprocessor, CancellationToken cancellationToken = default)

Parameters

options IOnnxSessionOptions
preprocessor IRFDetrDetectionPreprocessor
detectionPostprocessor IRFDetrDetectionPostprocessor
segmentationPostprocessor IRFDetrSegmentationPostprocessor
cancellationToken CancellationToken

Returns

Task