mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 10:56:31 +00:00
add ramdisk, load AI model to ramdisk and start recognition from it
rewrite zmq to DEALER and ROUTER add GET_USER command to get CurrentUser from Python all auth is on the python side inference run and validate annotations on python
This commit is contained in:
@@ -3,9 +3,11 @@ 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!;
|
||||
@@ -19,53 +21,36 @@ public class Annotation
|
||||
_thumbDir = config.ThumbnailsDirectory;
|
||||
}
|
||||
|
||||
public string Name { get; set; } = null!;
|
||||
public string ImageExtension { get; set; } = null!;
|
||||
public DateTime CreatedDate { get; set; }
|
||||
public string CreatedEmail { get; set; } = null!;
|
||||
public RoleEnum CreatedRole { get; set; }
|
||||
public SourceEnum Source { get; set; }
|
||||
public AnnotationStatus AnnotationStatus { get; set; }
|
||||
[IgnoreMember]public string Name { get; set; } = null!;
|
||||
[IgnoreMember]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; }
|
||||
|
||||
public IEnumerable<Detection> Detections { get; set; } = null!;
|
||||
[Key("d")] public IEnumerable<Detection> Detections { get; set; } = null!;
|
||||
[Key("t")] public long Milliseconds { get; set; }
|
||||
|
||||
public double Lat { get; set; }
|
||||
public double Lon { get; set; }
|
||||
[Key("lat")]public double Lat { get; set; }
|
||||
[Key("lon")]public double Lon { get; set; }
|
||||
|
||||
#region Calculated
|
||||
public List<int> Classes => Detections.Select(x => x.ClassNumber).ToList();
|
||||
public string ImagePath => Path.Combine(_imagesDir, $"{Name}{ImageExtension}");
|
||||
public string LabelPath => Path.Combine(_labelsDir, $"{Name}.txt");
|
||||
public string ThumbPath => Path.Combine(_thumbDir, $"{Name}{Constants.THUMBNAIL_PREFIX}.jpg");
|
||||
public string OriginalMediaName => $"{Name[..^7]}";
|
||||
[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");
|
||||
|
||||
private TimeSpan? _time;
|
||||
public TimeSpan Time
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_time.HasValue)
|
||||
return _time.Value;
|
||||
|
||||
var timeStr = Name.Split("_").LastOrDefault();
|
||||
|
||||
//For some reason, TimeSpan.ParseExact doesn't work on every platform.
|
||||
if (!string.IsNullOrEmpty(timeStr) &&
|
||||
timeStr.Length == 6 &&
|
||||
int.TryParse(timeStr[..1], out var hours) &&
|
||||
int.TryParse(timeStr[1..3], out var minutes) &&
|
||||
int.TryParse(timeStr[3..5], out var seconds) &&
|
||||
int.TryParse(timeStr[5..], out var milliseconds))
|
||||
return new TimeSpan(0, hours, minutes, seconds, milliseconds * 100);
|
||||
|
||||
_time = TimeSpan.FromSeconds(0);
|
||||
return _time.Value;
|
||||
}
|
||||
}
|
||||
#endregion Calculated
|
||||
}
|
||||
|
||||
|
||||
[MessagePackObject]
|
||||
public class AnnotationImage : Annotation
|
||||
{
|
||||
[Key("i")] public byte[] Image { get; set; }
|
||||
}
|
||||
|
||||
public enum AnnotationStatus
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user