Class YOLOv10<T>
- Namespace
- AiDotNet.ComputerVision.Detection.ObjectDetection.YOLO
- Assembly
- AiDotNet.dll
YOLOv10 object detector with NMS-free training and consistent dual assignments.
public class YOLOv10<T> : ObjectDetectorBase<T>
Type Parameters
TThe numeric type used for calculations.
- Inheritance
-
YOLOv10<T>
- Inherited Members
Remarks
For Beginners: YOLOv10 eliminates the need for Non-Maximum Suppression (NMS) during inference by using consistent dual assignments during training. This makes inference faster and simpler while maintaining accuracy.
Key features: - NMS-free inference via consistent dual assignments - One-to-one matching during inference (no duplicate predictions) - One-to-many matching for auxiliary training - Reduced post-processing latency
Reference: Wang et al., "YOLOv10: Real-Time End-to-End Object Detection", 2024
Constructors
YOLOv10(ObjectDetectionOptions<T>, bool)
Creates a new YOLOv10 detector.
public YOLOv10(ObjectDetectionOptions<T> options, bool useNmsFree = true)
Parameters
optionsObjectDetectionOptions<T>Detection options.
useNmsFreeboolWhether to use NMS-free inference (default true).
Properties
Name
Name of this detector architecture.
public override string Name { get; }
Property Value
Methods
Detect(Tensor<T>, double, double)
Detects objects in an image with custom thresholds.
public override DetectionResult<T> Detect(Tensor<T> image, double confidenceThreshold, double nmsThreshold)
Parameters
imageTensor<T>Input image tensor.
confidenceThresholddoubleMinimum confidence to keep a detection.
nmsThresholddoubleIoU threshold for NMS.
Returns
- DetectionResult<T>
Detection results.
Forward(Tensor<T>)
Performs forward pass through the network.
protected override List<Tensor<T>> Forward(Tensor<T> input)
Parameters
inputTensor<T>Input image tensor.
Returns
- List<Tensor<T>>
Raw network outputs before post-processing.
GetHeadParameterCount()
Gets the number of parameters in the detection head.
protected override long GetHeadParameterCount()
Returns
- long
Number of parameters.
LoadWeightsAsync(string, CancellationToken)
Loads pre-trained weights from a file or URL.
public override Task LoadWeightsAsync(string pathOrUrl, CancellationToken cancellationToken = default)
Parameters
pathOrUrlstringLocal file path or URL to weights.
cancellationTokenCancellationTokenCancellation token.
Returns
PostProcess(List<Tensor<T>>, int, int, double, double)
Post-processes raw network outputs into detections.
protected override List<Detection<T>> PostProcess(List<Tensor<T>> outputs, int imageWidth, int imageHeight, double confidenceThreshold, double nmsThreshold)
Parameters
outputsList<Tensor<T>>Raw network outputs.
imageWidthintOriginal image width.
imageHeightintOriginal image height.
confidenceThresholddoubleMinimum confidence threshold.
nmsThresholddoubleNMS IoU threshold.
Returns
SaveWeights(string)
Saves model weights to a file.
public override void SaveWeights(string path)
Parameters
pathstringFile path to save weights.