Files
OrpaonVision/OrpaonVision.SiteApp/Runtime/Contracts/YoloInferenceOptions.cs
2026-04-06 22:04:05 +08:00

88 lines
2.2 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
namespace OrpaonVision.SiteApp.Runtime.Contracts;
/// <summary>
/// YOLO推理配置选项。
/// </summary>
public sealed class YoloInferenceOptions
{
/// <summary>
/// 运行模式Real=真实YOLO推理Mock=模拟模式)。
/// </summary>
public string RunMode { get; set; } = "Mock"; // Real | Mock
/// <summary>
/// 模型文件路径。
/// </summary>
public string ModelPath { get; set; } = string.Empty;
/// <summary>
/// 标签文件路径。
/// </summary>
public string LabelsPath { get; set; } = string.Empty;
/// <summary>
/// 置信度阈值。
/// </summary>
public float ConfidenceThreshold { get; set; } = 0.5f;
/// <summary>
/// NMS阈值。
/// </summary>
public float NmsThreshold { get; set; } = 0.45f;
/// <summary>
/// 输入图像宽度。
/// </summary>
public int InputWidth { get; set; } = 640;
/// <summary>
/// 输入图像高度。
/// </summary>
public int InputHeight { get; set; } = 640;
/// <summary>
/// 是否使用GPU。
/// </summary>
public bool UseGpu { get; set; } = false;
/// <summary>
/// GPU设备ID。
/// </summary>
public int GpuDeviceId { get; set; } = 0;
/// <summary>
/// 批处理大小。
/// </summary>
public int BatchSize { get; set; } = 1;
/// <summary>
/// 模型类型ONNX、TorchScript等
/// </summary>
public string ModelType { get; set; } = "ONNX";
/// <summary>
/// 是否启用自动预热。
/// </summary>
public bool EnableWarmup { get; set; } = true;
/// <summary>
/// 预热次数。
/// </summary>
public int WarmupCount { get; set; } = 3;
/// <summary>
/// YOLO推理引擎类型YoloDotNet、OpenCV、TensorRT等
/// </summary>
public string InferenceEngine { get; set; } = "YoloDotNet";
/// <summary>
/// ONNX Runtime执行提供程序CPU、CUDA等
/// </summary>
public string OnnxRuntimeProvider { get; set; } = "CPU";
/// <summary>
/// 模型版本信息。
/// </summary>
public string ModelVersion { get; set; } = "v1.0";
}