Class Detection<T>
- Namespace
- AiDotNet.ComputerVision.Detection.ObjectDetection
- Assembly
- AiDotNet.dll
Represents a single detected object.
public class Detection<T>
Type Parameters
TThe numeric type used for coordinates and scores.
- Inheritance
-
Detection<T>
- Inherited Members
Remarks
For Beginners: This represents one object found in the image. It tells you: - Where the object is (bounding box) - What type of object it is (class ID and name) - How confident the model is (0.0 to 1.0) - Optionally, a pixel mask for instance segmentation
Constructors
Detection()
Creates a new detection with default numeric operations.
public Detection()
Detection(BoundingBox<T>, int, T, string?)
Creates a new detection with specified values.
public Detection(BoundingBox<T> box, int classId, T confidence, string? className = null)
Parameters
boxBoundingBox<T>The bounding box.
classIdintThe class ID.
confidenceTThe confidence score.
classNamestringOptional class name.
Properties
Area
Gets the area of the bounding box.
public double Area { get; }
Property Value
Box
The bounding box defining the object's location.
public BoundingBox<T> Box { get; set; }
Property Value
- BoundingBox<T>
CenterX
Gets the center X coordinate of the bounding box.
public double CenterX { get; }
Property Value
CenterY
Gets the center Y coordinate of the bounding box.
public double CenterY { get; }
Property Value
ClassId
The class ID (index) of the detected object.
public int ClassId { get; set; }
Property Value
ClassName
The human-readable name of the class (e.g., "person", "car").
public string? ClassName { get; set; }
Property Value
Confidence
Confidence score from 0 to 1 indicating detection certainty.
public T Confidence { get; set; }
Property Value
- T
Keypoints
Optional keypoints for pose estimation.
public List<Keypoint<T>>? Keypoints { get; set; }
Property Value
Mask
Optional instance segmentation mask for this object.
public SegmentationMask<T>? Mask { get; set; }
Property Value
Remarks
Only populated when using instance segmentation models like Mask R-CNN or YOLOv8-Seg.
TrackId
Optional track ID for object tracking across frames.
public int? TrackId { get; set; }
Property Value
- int?
Methods
ToString()
Gets a string representation of this detection.
public override string ToString()