fix ai detection bugs #1

This commit is contained in:
Alex Bezdieniezhnykh
2024-11-04 21:12:45 +02:00
parent addf7ccc11
commit d8f60d7491
10 changed files with 172 additions and 66 deletions
+20 -2
View File
@@ -1,7 +1,8 @@
using System.Globalization;
using System.Drawing;
using System.Globalization;
using System.IO;
using System.Windows;
using Newtonsoft.Json;
using Size = System.Windows.Size;
namespace Azaion.Annotator.DTO;
@@ -98,6 +99,9 @@ public class YoloLabel : Label
Height = height;
}
public RectangleF ToRectangle() =>
new((float)(CenterX - Width / 2.0), (float)(CenterY - Height / 2.0), (float)Width, (float)Height);
public YoloLabel(CanvasLabel canvasLabel, Size canvasSize, Size videoSize)
{
var cw = canvasSize.Width;
@@ -168,4 +172,18 @@ public class YoloLabel : Label
}
public override string ToString() => $"{ClassNumber} {CenterX:F5} {CenterY:F5} {Width:F5} {Height:F5}".Replace(',', '.');
}
public class Detection : YoloLabel
{
public Detection(YoloLabel label, double? probability = null)
{
ClassNumber = label.ClassNumber;
CenterX = label.CenterX;
CenterY = label.CenterY;
Height = label.Height;
Width = label.Width;
Probability = probability;
}
public double? Probability { get; set; }
}