mirror of
https://github.com/azaion/annotations.git
synced 2026-04-23 03:36:31 +00:00
add results pane
differentiate videos which already has annotations
This commit is contained in:
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user