fix ai detection bugs #2

This commit is contained in:
Alex Bezdieniezhnykh
2024-11-05 13:01:36 +02:00
parent d8f60d7491
commit 5d537aeef6
6 changed files with 63 additions and 42 deletions
+7 -11
View File
@@ -13,12 +13,9 @@ public class AnnotationResult
[JsonProperty(PropertyName = "t")]
public TimeSpan Time { get; set; }
[JsonProperty(PropertyName = "p")]
public double Percentage { get; set; }
public double Lat { get; set; }
public double Lon { get; set; }
public List<YoloLabel> Labels { get; set; } = new();
public List<Detection> Detections { get; set; } = new();
#region For Display in the grid
@@ -32,10 +29,10 @@ public class AnnotationResult
{
get
{
if (Labels.Count == 0)
if (Detections.Count == 0)
return "";
var groups = Labels.Select(x => x.ClassNumber).GroupBy(x => x).ToList();
var groups = Detections.Select(x => x.ClassNumber).GroupBy(x => x).ToList();
return groups.Count > 1
? string.Join(",", groups.Select(x => x.Key + 1))
: _config.AnnotationClassesDict[groups.FirstOrDefault().Key].Name;
@@ -49,10 +46,10 @@ public class AnnotationResult
get
{
var defaultColor = (Color)ColorConverter.ConvertFromString("#404040");
if (Labels.Count == 0)
if (Detections.Count == 0)
return defaultColor;
var groups = Labels.Select(x => x.ClassNumber).GroupBy(x => x).ToList();
var groups = Detections.Select(x => x.ClassNumber).GroupBy(x => x).ToList();
return groups.Count > 1
? defaultColor
@@ -64,12 +61,11 @@ public class AnnotationResult
#endregion
public AnnotationResult() { }
public AnnotationResult(TimeSpan time, string timeName, List<YoloLabel> labels, Config config)
public AnnotationResult(TimeSpan time, string timeName, List<Detection> detections, Config config)
{
_config = config;
Labels = labels;
Detections = detections;
Time = time;
Image = $"{timeName}.jpg";
Percentage = 100;
}
}