add db WIP 2, 80%

refactor, renames
This commit is contained in:
Alex Bezdieniezhnykh
2024-12-24 06:07:13 +02:00
parent 5fa18aa514
commit 48c9ccbfda
32 changed files with 499 additions and 459 deletions
+3 -3
View File
@@ -15,7 +15,7 @@ namespace Azaion.Annotator;
public interface IAIDetector
{
Task<List<Detection>> Detect(Stream imageStream, CancellationToken cancellationToken = default);
Task<List<Detection>> Detect(string fName, Stream imageStream, CancellationToken cancellationToken = default);
}
public class YOLODetector(IOptions<AIRecognitionConfig> recognitionConfig, IResourceLoader resourceLoader) : IAIDetector, IDisposable
@@ -25,7 +25,7 @@ public class YOLODetector(IOptions<AIRecognitionConfig> recognitionConfig, IReso
private const string YOLO_MODEL = "azaion.onnx";
public async Task<List<Detection>> Detect(Stream imageStream, CancellationToken cancellationToken)
public async Task<List<Detection>> Detect(string fName, Stream imageStream, CancellationToken cancellationToken)
{
if (_predictor == null)
{
@@ -42,7 +42,7 @@ public class YOLODetector(IOptions<AIRecognitionConfig> recognitionConfig, IReso
var detections = result.Select(d =>
{
var label = new YoloLabel(new CanvasLabel(d.Name.Id, d.Bounds.X, d.Bounds.Y, d.Bounds.Width, d.Bounds.Height), imageSize, imageSize);
return new Detection(label, (double?)d.Confidence * 100);
return new Detection(fName, label, (double?)d.Confidence * 100);
}).ToList();
return FilterOverlapping(detections);