mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 22:16:30 +00:00
a5fcb0988b
make annotationstatus more clear
65 lines
2.5 KiB
C#
65 lines
2.5 KiB
C#
using System.IO;
|
|
using Azaion.Common.DTO;
|
|
using Azaion.Common.DTO.Config;
|
|
using Azaion.Common.DTO.Queue;
|
|
using Azaion.CommonSecurity.DTO;
|
|
using MessagePack;
|
|
|
|
namespace Azaion.Common.Database;
|
|
|
|
[MessagePackObject]
|
|
public class Annotation
|
|
{
|
|
private static string _labelsDir = null!;
|
|
private static string _imagesDir = null!;
|
|
private static string _thumbDir = null!;
|
|
|
|
public static void InitializeDirs(DirectoriesConfig config)
|
|
{
|
|
_labelsDir = config.LabelsDirectory;
|
|
_imagesDir = config.ImagesDirectory;
|
|
_thumbDir = config.ThumbnailsDirectory;
|
|
}
|
|
|
|
[Key("n")] public string Name { get; set; } = null!;
|
|
[Key("mn")] public string OriginalMediaName { get; set; } = null!;
|
|
[IgnoreMember]public TimeSpan Time { get; set; }
|
|
[IgnoreMember]public string ImageExtension { get; set; } = null!;
|
|
[IgnoreMember]public DateTime CreatedDate { get; set; }
|
|
[IgnoreMember]public string CreatedEmail { get; set; } = null!;
|
|
[IgnoreMember]public RoleEnum CreatedRole { get; set; }
|
|
[IgnoreMember]public SourceEnum Source { get; set; }
|
|
[IgnoreMember]public AnnotationStatus AnnotationStatus { get; set; }
|
|
|
|
[IgnoreMember]public DateTime ValidateDate { get; set; }
|
|
[IgnoreMember]public string ValidateEmail { get; set; } = null!;
|
|
|
|
[Key("d")] public IEnumerable<Detection> Detections { get; set; } = null!;
|
|
[Key("t")] public long Milliseconds { get; set; }
|
|
|
|
[Key("lat")]public double Lat { get; set; }
|
|
[Key("lon")]public double Lon { get; set; }
|
|
|
|
#region Calculated
|
|
[IgnoreMember]public List<int> Classes => Detections.Select(x => x.ClassNumber).ToList();
|
|
[IgnoreMember]public string ImagePath => Path.Combine(_imagesDir, $"{Name}{ImageExtension}");
|
|
[IgnoreMember]public string LabelPath => Path.Combine(_labelsDir, $"{Name}.txt");
|
|
[IgnoreMember]public string ThumbPath => Path.Combine(_thumbDir, $"{Name}{Constants.THUMBNAIL_PREFIX}.jpg");
|
|
|
|
#endregion Calculated
|
|
}
|
|
|
|
[MessagePackObject]
|
|
public class AnnotationImage : Annotation
|
|
{
|
|
[Key("i")] public byte[] Image { get; set; } = null!;
|
|
}
|
|
|
|
public enum AnnotationStatus
|
|
{
|
|
None = 0,
|
|
Created = 10,
|
|
Edited = 20,
|
|
Validated = 30,
|
|
Deleted = 40
|
|
} |