2026-02-15 15:16:56 +01:00
|
|
|
using OpenCvSharp;
|
|
|
|
|
|
|
|
|
|
namespace AIFotoONLUS.Core
|
|
|
|
|
{
|
2026-02-15 23:37:08 +01:00
|
|
|
/// <summary>
|
|
|
|
|
/// Configuration options that control model file locations, input sizes
|
|
|
|
|
/// and runtime thresholds used by <see cref="NumberRecognitionEngine"/>.
|
|
|
|
|
/// </summary>
|
2026-02-15 15:16:56 +01:00
|
|
|
public class ModelConfiguration
|
|
|
|
|
{
|
2026-02-15 23:37:08 +01:00
|
|
|
/// <summary>
|
|
|
|
|
/// Path to the Darknet configuration (.cfg) file for the detection network.
|
|
|
|
|
/// </summary>
|
2026-02-15 15:16:56 +01:00
|
|
|
public string DetectionCfg { get; set; } = "models/detection.cfg";
|
2026-02-15 23:37:08 +01:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Path to the Darknet weights (.weights) file for the detection network.
|
|
|
|
|
/// </summary>
|
2026-02-15 15:16:56 +01:00
|
|
|
public string DetectionWeights { get; set; } = "models/detection.weights";
|
2026-02-15 23:37:08 +01:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Path to the Darknet configuration (.cfg) file for the recognition network.
|
|
|
|
|
/// </summary>
|
2026-02-15 15:16:56 +01:00
|
|
|
public string RecognitionCfg { get; set; } = "models/recognition.cfg";
|
2026-02-15 23:37:08 +01:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Path to the Darknet weights (.weights) file for the recognition network.
|
|
|
|
|
/// </summary>
|
2026-02-15 15:16:56 +01:00
|
|
|
public string RecognitionWeights { get; set; } = "models/recognition.weights";
|
|
|
|
|
|
2026-02-15 23:37:08 +01:00
|
|
|
/// <summary>
|
|
|
|
|
/// Confidence threshold used to filter out low-probability detections.
|
|
|
|
|
/// </summary>
|
2026-02-15 15:16:56 +01:00
|
|
|
public double ConfidenceThreshold { get; set; } = 0.5;
|
2026-02-15 23:37:08 +01:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Non-maximum suppression (NMS) IoU threshold used to remove overlapping
|
|
|
|
|
/// detection boxes.
|
|
|
|
|
/// </summary>
|
2026-02-15 15:16:56 +01:00
|
|
|
public double NmsThreshold { get; set; } = 0.4;
|
|
|
|
|
|
2026-02-15 23:37:08 +01:00
|
|
|
/// <summary>
|
|
|
|
|
/// Input size used when preparing the blob for the detection network.
|
|
|
|
|
/// </summary>
|
2026-02-15 15:16:56 +01:00
|
|
|
public Size DetectionInputSize { get; set; } = new Size(416, 416);
|
2026-02-15 23:37:08 +01:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Input size used when preparing the blob for the recognition network.
|
|
|
|
|
/// </summary>
|
2026-02-15 15:16:56 +01:00
|
|
|
public Size RecognitionInputSize { get; set; } = new Size(140, 120);
|
|
|
|
|
|
2026-02-15 23:37:08 +01:00
|
|
|
/// <summary>
|
|
|
|
|
/// Labels representing digit classes in the recognition model. The order
|
|
|
|
|
/// must match the class ordering used by the trained recognition network.
|
|
|
|
|
/// </summary>
|
2026-02-15 15:16:56 +01:00
|
|
|
public string[] NumberClasses { get; set; } = new[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" };
|
2026-02-15 23:37:08 +01:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// When enabled, recognition crops will be saved to disk under
|
|
|
|
|
/// "logs/crops" for diagnostic inspection. Disabled by default.
|
|
|
|
|
/// </summary>
|
2026-02-15 18:06:03 +01:00
|
|
|
public bool EnableCropSaving { get; set; } = false;
|
2026-02-15 15:16:56 +01:00
|
|
|
}
|
|
|
|
|
}
|