mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 22:26:31 +00:00
add offset
fixes add visual validation border and validate functionality
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
using System.IO;
|
||||
using Azaion.Common.DTO;
|
||||
using Azaion.Common.DTO.Config;
|
||||
using Azaion.Common.DTO.Queue;
|
||||
using Azaion.CommonSecurity.DTO;
|
||||
|
||||
namespace Azaion.Common.Database;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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; }
|
||||
|
||||
public IEnumerable<Detection> Detections { get; set; } = null!;
|
||||
|
||||
public double Lat { get; set; }
|
||||
public double Lon { get; set; }
|
||||
|
||||
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 enum AnnotationStatus
|
||||
{
|
||||
None = 0,
|
||||
Created = 10,
|
||||
Validated = 20
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace Azaion.Common.Database;
|
||||
|
||||
public class AnnotationName
|
||||
{
|
||||
public string Name { get; set; } = null!;
|
||||
}
|
||||
@@ -9,4 +9,5 @@ public class AnnotationsDb(DataOptions dataOptions) : DataConnection(dataOptions
|
||||
public ITable<Annotation> Annotations => this.GetTable<Annotation>();
|
||||
public ITable<AnnotationName> AnnotationsQueue => this.GetTable<AnnotationName>();
|
||||
public ITable<Detection> Detections => this.GetTable<Detection>();
|
||||
public ITable<QueueOffset> QueueOffsets => this.GetTable<QueueOffset>();
|
||||
}
|
||||
@@ -4,6 +4,7 @@ using System.IO;
|
||||
using Azaion.Common.DTO;
|
||||
using Azaion.Common.DTO.Config;
|
||||
using LinqToDB;
|
||||
using LinqToDB.Data;
|
||||
using LinqToDB.DataProvider.SQLite;
|
||||
using LinqToDB.Mapping;
|
||||
using Microsoft.Extensions.Logging;
|
||||
@@ -63,6 +64,20 @@ public class DbFactory : IDbFactory
|
||||
db.CreateTable<Annotation>();
|
||||
db.CreateTable<AnnotationName>();
|
||||
db.CreateTable<Detection>();
|
||||
db.CreateTable<QueueOffset>();
|
||||
db.QueueOffsets.BulkCopy(new List<QueueOffset>
|
||||
{
|
||||
new()
|
||||
{
|
||||
Offset = 0,
|
||||
QueueName = Constants.MQ_ANNOTATIONS_QUEUE
|
||||
},
|
||||
new()
|
||||
{
|
||||
Offset = 0,
|
||||
QueueName = Constants.MQ_ANNOTATIONS_CONFIRM_QUEUE
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public async Task<T> Run<T>(Func<AnnotationsDb, Task<T>> func)
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace Azaion.Common.Database;
|
||||
|
||||
public class QueueOffset
|
||||
{
|
||||
public string QueueName { get; set; } = null!;
|
||||
public ulong Offset { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user