Table of Contents

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

T

The 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

int

Detections

List of all detected objects in the image.

public List<Detection<T>> Detections { get; set; }

Property Value

List<Detection<T>>

ImageHeight

Original image height in pixels.

public int ImageHeight { get; set; }

Property Value

int

ImageWidth

Original image width in pixels.

public int ImageWidth { get; set; }

Property Value

int

InferenceTime

Time taken to run inference.

public TimeSpan InferenceTime { get; set; }

Property Value

TimeSpan

ModelName

Model name that produced these detections.

public string? ModelName { get; set; }

Property Value

string

Methods

FilterByClass(params int[])

Filters detections by class ID.

public DetectionResult<T> FilterByClass(params int[] classIds)

Parameters

classIds int[]

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

minConfidence double

Minimum 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

n int

Maximum number of detections to return.

Returns

DetectionResult<T>

A new DetectionResult with top N detections.