add results pane

differentiate videos which already has annotations
This commit is contained in:
Oleksandr Bezdieniezhnykh
2024-07-20 13:50:10 +03:00
parent 288a34e992
commit 83e3532de2
11 changed files with 189 additions and 87 deletions
+50 -7
View File
@@ -1,29 +1,72 @@
using Newtonsoft.Json;
using System.Windows.Media;
using Newtonsoft.Json;
namespace Azaion.Annotator.DTO;
public class AnnotationResult
{
private readonly Config _config = null!;
[JsonProperty(PropertyName = "f")]
public string Image { get; set; } = null!;
[JsonProperty(PropertyName = "t")]
public TimeSpan Time { get; set; }
[JsonIgnore]
public string TimeStr => $"{Time:h\\:mm\\:ss}";
[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();
#region For Display in the grid
[JsonIgnore]
//For XAML Form
public string TimeStr => $"{Time:h\\:mm\\:ss}";
[JsonIgnore]
//For XAML Form
public string ClassName
{
get
{
if (Labels.Count == 0)
return "";
var groups = Labels.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;
}
}
[JsonIgnore]
//For XAML Form
public Color ClassColor
{
get
{
var defaultColor = (Color)ColorConverter.ConvertFromString("#404040");
if (Labels.Count == 0)
return defaultColor;
var groups = Labels.Select(x => x.ClassNumber).GroupBy(x => x).ToList();
return groups.Count > 1
? defaultColor
: _config.AnnotationClassesDict[groups.FirstOrDefault().Key].Color;
}
}
#endregion
public AnnotationResult() { }
public AnnotationResult(TimeSpan time, string timeName, List<YoloLabel> labels)
public AnnotationResult(TimeSpan time, string timeName, List<YoloLabel> labels, Config config)
{
_config = config;
Labels = labels;
Time = time;
Image = $"{timeName}.jpg";