Divooka.Onnx
Divooka.Onnx.MLModels.YoloV2
A simple interface to YoLoV2 (Tiny) for object detection in image.
Requires model file. Currently implementation works only on Windows but should be easy to change with SkiaSharp.
Remarks
References: https://learn.microsoft.com/en-us/dotnet/machine-learning/tutorials/object-detection-onnx
https://github.com/dotnet/machinelearning-samples/tree/main/samples/csharp/getting-started/DeepLearning_ObjectDetection_Onnx
Divooka.Onnx.MLModels.YoloV2.OnnxModelScorer
Scores ONNX models on input data.
Divooka.Onnx.MLModels.YoloV2.OnnxModelScorer.#ctor()
Initializes a new instance of the OnnxModelScorer class.
Parameters
| Name | Description | Default |
|---|---|---|
imagesFolder |
Folder containing images. | |
modelLocation |
Path to the ONNX model file. | |
mlContext |
MLContext instance. |
Divooka.Onnx.MLModels.YoloV2.OnnxModelScorer.Score()
Scores the data using the ONNX model.
Parameters
| Name | Description | Default |
|---|---|---|
data |
The input data view. |
Returns
A collection of model output probabilities.
Divooka.Onnx.MLModels.YoloV2.ImageNetSettings
ImageNet settings.
Divooka.Onnx.MLModels.YoloV2.TinyYoloModelSettings
Tiny YOLO model settings.
Divooka.Onnx.MLModels.YoloV2.DimensionsBase
Base class representing dimensions.
Divooka.Onnx.MLModels.YoloV2.DimensionsBase.X
Gets or sets the X coordinate.
Divooka.Onnx.MLModels.YoloV2.DimensionsBase.Y
Gets or sets the Y coordinate.
Divooka.Onnx.MLModels.YoloV2.DimensionsBase.Height
Gets or sets the height.
Divooka.Onnx.MLModels.YoloV2.DimensionsBase.Width
Gets or sets the width.
Divooka.Onnx.MLModels.YoloV2.DimensionsBase.Right
Gets the right boundary (X + Width).
Divooka.Onnx.MLModels.YoloV2.DimensionsBase.Bottom
Gets the bottom boundary (Y + Height).
Divooka.Onnx.MLModels.YoloV2.DimensionsBase.#ctor
Initializes a new instance of the DimensionsBase class.
Divooka.Onnx.MLModels.YoloV2.DimensionsBase.#ctor()
Initializes a new instance of the DimensionsBase class with specified values.
Parameters
| Name | Description | Default |
|---|---|---|
x |
X coordinate. | |
y |
Y coordinate. | |
height |
Height value. | |
width |
Width value. |
Divooka.Onnx.MLModels.YoloV2.BoundingBoxDimensions
Represents bounding box dimensions.
Divooka.Onnx.MLModels.YoloV2.CellDimensions
Represents cell dimensions.
Divooka.Onnx.MLModels.YoloV2.YoloBoundingBox
Represents a detected YOLO bounding box.
Divooka.Onnx.MLModels.YoloV2.YoloBoundingBox.Dimensions
Gets or sets the dimensions of the bounding box.
Divooka.Onnx.MLModels.YoloV2.YoloBoundingBox.Label
Gets or sets the label of the detected object.
Divooka.Onnx.MLModels.YoloV2.YoloBoundingBox.Confidence
Gets or sets the confidence score.
Divooka.Onnx.MLModels.YoloV2.YoloBoundingBox.Rect
Gets the rectangle representing the bounding box.
Divooka.Onnx.MLModels.YoloV2.YoloBoundingBox.BoxColor
Gets or sets the color of the bounding box.
Divooka.Onnx.MLModels.YoloV2.YoloV2MiniParameters
Contains parameters for the YoloV2 mini model.
Divooka.Onnx.MLModels.YoloV2.BatchProcess()
Batch processes images for object detection.
Parameters
| Name | Description | Default |
|---|---|---|
imagesFolder |
Folder containing input images. | |
outputsFolder |
Folder to save processed images. |
Divooka.Onnx.MLModels.YoloV2.DrawBoundingBox()
Draws bounding boxes on an image.
Parameters
| Name | Description | Default |
|---|---|---|
inputImageLocation |
Location of the input image. | |
outputImageLocation |
Location to save the output image. | |
imageName |
Name of the image file. | |
filteredBoundingBoxes |
List of bounding boxes to draw. |
Divooka.Onnx.MLModels.YoloV2.LogDetectedObjects()
Logs detected objects in the image.
Parameters
| Name | Description | Default |
|---|---|---|
imageName |
Name of the image file. | |
boundingBoxes |
List of detected bounding boxes. |
Divooka.Onnx.MLModels.YoloV2.ParseOutputs()
Parses the model outputs into bounding boxes.
Parameters
| Name | Description | Default |
|---|---|---|
yoloModelOutputs |
Array of model outputs. | |
threshold |
Threshold for detection. |
Returns
List of detected bounding boxes.
Divooka.Onnx.MLModels.YoloV2.FilterBoundingBoxes()
Filters the bounding boxes based on overlap.
Parameters
| Name | Description | Default |
|---|---|---|
boxes |
List of detected bounding boxes. | |
limit |
Maximum number of bounding boxes to return. | |
threshold |
Intersection over union threshold. |
Returns
Filtered list of bounding boxes.
Divooka.Onnx.MLModels.YoloV2.GetAbsolutePath()
Combines folder path and relative path into an absolute path.
Parameters
| Name | Description | Default |
|---|---|---|
folderPath |
The folder path. | |
relativePath |
The relative path. |
Returns
The combined absolute path.
Divooka.Onnx.OnnxRunner.Example()
Loads the images of the imagesFolder into an IDataView.
Parameters
| Name | Description | Default |
|---|---|---|
imagesFolder |
||
imagesDataFile |
TSV containing two columns: Image Path and Name |