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:
Alex Bezdieniezhnykh
2025-01-29 17:45:26 +02:00
parent 82b3b526a7
commit 62623b7123
55 changed files with 945 additions and 895 deletions
@@ -1,10 +1,15 @@
using MessagePack;
namespace Azaion.Common.DTO.Config;
[MessagePackObject]
public class AIRecognitionConfig
{
public double FrameRecognitionSeconds { get; set; }
public double TrackingDistanceConfidence { get; set; }
public double TrackingProbabilityIncrease { get; set; }
public double TrackingIntersectionThreshold { get; set; }
public int FramePeriodRecognition { get; set; }
[Key("FrameRecognitionSeconds")] public double FrameRecognitionSeconds { get; set; }
[Key("TrackingDistanceConfidence")] public double TrackingDistanceConfidence { get; set; }
[Key("TrackingProbabilityIncrease")] public double TrackingProbabilityIncrease { get; set; }
[Key("TrackingIntersectionThreshold")] public double TrackingIntersectionThreshold { get; set; }
[Key("FramePeriodRecognition")] public int FramePeriodRecognition { get; set; }
[Key("Data")] public byte[] Data { get; set; }
}
-9
View File
@@ -8,8 +8,6 @@ namespace Azaion.Common.DTO.Config;
public class AppConfig
{
public ApiConfig ApiConfig { get; set; } = null!;
public QueueConfig QueueConfig { get; set; } = null!;
public DirectoriesConfig DirectoriesConfig { get; set; } = null!;
@@ -39,13 +37,6 @@ public class ConfigUpdater : IConfigUpdater
var appConfig = new AppConfig
{
ApiConfig = new ApiConfig
{
Url = SecurityConstants.DEFAULT_API_URL,
RetryCount = SecurityConstants.DEFAULT_API_RETRY_COUNT,
TimeoutSeconds = SecurityConstants.DEFAULT_API_TIMEOUT_SECONDS
},
AnnotationConfig = new AnnotationConfig
{
AnnotationClasses = Constants.DefaultAnnotationClasses,
-2
View File
@@ -16,6 +16,4 @@ public class FormState
public int CurrentVolume { get; set; } = 100;
public ObservableCollection<AnnotationResult> AnnotationResults { get; set; } = [];
public WindowEnum ActiveWindow { get; set; }
public string GetTimeName(TimeSpan? ts) => $"{VideoName}_{ts:hmmssf}";
}
+13 -11
View File
@@ -1,18 +1,18 @@
using System.Drawing;
using System.Globalization;
using System.IO;
using MessagePack;
using Newtonsoft.Json;
using Size = System.Windows.Size;
namespace Azaion.Common.DTO;
[MessagePackObject]
public abstract class Label
{
[JsonProperty(PropertyName = "cl")] public int ClassNumber { get; set; }
[JsonProperty(PropertyName = "cl")][Key("c")] public int ClassNumber { get; set; }
protected Label()
{
}
protected Label() { }
protected Label(int classNumber)
{
@@ -79,15 +79,16 @@ public class CanvasLabel : Label
}
}
[MessagePackObject]
public class YoloLabel : Label
{
[JsonProperty(PropertyName = "x")] public double CenterX { get; set; }
[JsonProperty(PropertyName = "x")][Key("x")] public double CenterX { get; set; }
[JsonProperty(PropertyName = "y")] public double CenterY { get; set; }
[JsonProperty(PropertyName = "y")][Key("y")] public double CenterY { get; set; }
[JsonProperty(PropertyName = "w")] public double Width { get; set; }
[JsonProperty(PropertyName = "w")][Key("w")] public double Width { get; set; }
[JsonProperty(PropertyName = "h")] public double Height { get; set; }
[JsonProperty(PropertyName = "h")][Key("h")] public double Height { get; set; }
public YoloLabel()
{
@@ -184,12 +185,13 @@ public class YoloLabel : Label
public override string ToString() => $"{ClassNumber} {CenterX:F5} {CenterY:F5} {Width:F5} {Height:F5}".Replace(',', '.');
}
[MessagePackObject]
public class Detection : YoloLabel
{
public string AnnotationName { get; set; } = null!;
public double? Probability { get; set; }
[IgnoreMember]public string AnnotationName { get; set; } = null!;
[Key("p")] public double? Probability { get; set; }
//For db
//For db & serialization
public Detection(){}
public Detection(string annotationName, YoloLabel label, double? probability = null)
+4 -2
View File
@@ -1,4 +1,6 @@
namespace Azaion.Common.DTO;
using Azaion.Common.Extensions;
namespace Azaion.Common.DTO;
public class MediaFileInfo
{
@@ -9,5 +11,5 @@ public class MediaFileInfo
public bool HasAnnotations { get; set; }
public MediaTypes MediaType { get; set; }
public string FName => System.IO.Path.GetFileNameWithoutExtension(Name).Replace(" ", "");
public string FName => Name.ToFName();
}
@@ -7,15 +7,17 @@ using MessagePack;
[MessagePackObject]
public class AnnotationCreatedMessage
{
[Key(0)] public DateTime CreatedDate { get; set; }
[Key(1)] public string Name { get; set; } = null!;
[Key(2)] public string ImageExtension { get; set; } = null!;
[Key(3)] public string Detections { get; set; } = null!;
[Key(4)] public byte[] Image { get; set; } = null!;
[Key(5)] public RoleEnum CreatedRole { get; set; }
[Key(6)] public string CreatedEmail { get; set; } = null!;
[Key(7)] public SourceEnum Source { get; set; }
[Key(8)] public AnnotationStatus Status { get; set; }
[Key(0)] public DateTime CreatedDate { get; set; }
[Key(1)] public string Name { get; set; } = null!;
[Key(2)] public string OriginalMediaName { get; set; } = null!;
[Key(3)] public TimeSpan Time { get; set; }
[Key(4)] public string ImageExtension { get; set; } = null!;
[Key(5)] public string Detections { get; set; } = null!;
[Key(6)] public byte[] Image { get; set; } = null!;
[Key(7)] public RoleEnum CreatedRole { get; set; }
[Key(8)] public string CreatedEmail { get; set; } = null!;
[Key(9)] public SourceEnum Source { get; set; }
[Key(10)] public AnnotationStatus Status { get; set; }
}
[MessagePackObject]