Class DetectionResult<T>
- Namespace
- AiDotNet.ComputerVision.Detection.ObjectDetection
- Assembly
- AiDotNet.dll
Contains the results of object detection on an image.
public class DetectionResult<T>
Type Parameters
TThe numeric type used for coordinates and scores.
- Inheritance
-
DetectionResult<T>
- Inherited Members
Remarks
For Beginners: This class holds all the objects detected in an image. Each detection includes: - A bounding box showing where the object is - The class/category of the object (e.g., "person", "car") - A confidence score indicating how sure the model is
Properties
Count
Gets the number of detections.
public int Count { get; }
Property Value
Detections
List of all detected objects in the image.
public List<Detection<T>> Detections { get; set; }
Property Value
ImageHeight
Original image height in pixels.
public int ImageHeight { get; set; }
Property Value
ImageWidth
Original image width in pixels.
public int ImageWidth { get; set; }
Property Value
InferenceTime
Time taken to run inference.
public TimeSpan InferenceTime { get; set; }
Property Value
ModelName
Model name that produced these detections.
public string? ModelName { get; set; }
Property Value
Methods
FilterByClass(params int[])
Filters detections by class ID.
public DetectionResult<T> FilterByClass(params int[] classIds)
Parameters
classIdsint[]Class IDs to keep.
Returns
- DetectionResult<T>
A new DetectionResult with filtered detections.
FilterByConfidence(double)
Filters detections by confidence threshold.
public DetectionResult<T> FilterByConfidence(double minConfidence)
Parameters
minConfidencedoubleMinimum confidence score to keep.
Returns
- DetectionResult<T>
A new DetectionResult with filtered detections.
SortByConfidence()
Gets detections sorted by confidence (highest first).
public DetectionResult<T> SortByConfidence()
Returns
- DetectionResult<T>
A new DetectionResult with sorted detections.
TopN(int)
Gets the top N detections by confidence.
public DetectionResult<T> TopN(int n)
Parameters
nintMaximum number of detections to return.
Returns
- DetectionResult<T>
A new DetectionResult with top N detections.