add db WIP 2, 80%

refactor, renames
This commit is contained in:
Alex Bezdieniezhnykh
2024-12-24 06:07:13 +02:00
parent 5fa18aa514
commit 48c9ccbfda
32 changed files with 499 additions and 459 deletions
+16 -6
View File
@@ -41,12 +41,14 @@ public class CanvasLabel : Label
Probability = probability;
}
public CanvasLabel(YoloLabel label, Size canvasSize, Size videoSize, double? probability = null)
public CanvasLabel(YoloLabel label, Size canvasSize, Size? videoSize = null, double? probability = null)
{
var cw = canvasSize.Width;
var ch = canvasSize.Height;
var canvasAr = cw / ch;
var videoAr = videoSize.Width / videoSize.Height;
var videoAr = videoSize.HasValue
? videoSize.Value.Width / videoSize.Value.Height
: canvasAr;
ClassNumber = label.ClassNumber;
@@ -102,12 +104,14 @@ public class YoloLabel : Label
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)
public YoloLabel(CanvasLabel canvasLabel, Size canvasSize, Size? videoSize = null)
{
var cw = canvasSize.Width;
var ch = canvasSize.Height;
var canvasAr = cw / ch;
var videoAr = videoSize.Width / videoSize.Height;
var videoAr = videoSize.HasValue
? videoSize.Value.Width / videoSize.Value.Height
: canvasAr;
ClassNumber = canvasLabel.ClassNumber;
@@ -182,8 +186,15 @@ public class YoloLabel : Label
public class Detection : YoloLabel
{
public Detection(YoloLabel label, double? probability = null)
public string AnnotationName { get; set; }
public double? Probability { get; set; }
//For db
public Detection(){}
public Detection(string annotationName, YoloLabel label, double? probability = null)
{
AnnotationName = annotationName;
ClassNumber = label.ClassNumber;
CenterX = label.CenterX;
CenterY = label.CenterY;
@@ -191,5 +202,4 @@ public class Detection : YoloLabel
Width = label.Width;
Probability = probability;
}
public double? Probability { get; set; }
}