mirror of
https://github.com/azaion/annotations.git
synced 2026-04-23 01:56:31 +00:00
fix ui bugs, fix RefreshThumbnails method
This commit is contained in:
@@ -147,7 +147,7 @@ public class AnnotationService : INotificationHandler<AnnotationsDeletedEvent>
|
|||||||
: AnnotationStatus.Created;
|
: AnnotationStatus.Created;
|
||||||
|
|
||||||
await db.Detections.DeleteAsync(x => x.AnnotationName == fName, token: token);
|
await db.Detections.DeleteAsync(x => x.AnnotationName == fName, token: token);
|
||||||
await db.BulkCopyAsync(detections, cancellationToken: token);
|
|
||||||
if (ann != null)
|
if (ann != null)
|
||||||
{
|
{
|
||||||
await db.Annotations
|
await db.Annotations
|
||||||
@@ -177,6 +177,7 @@ public class AnnotationService : INotificationHandler<AnnotationsDeletedEvent>
|
|||||||
};
|
};
|
||||||
await db.InsertAsync(ann, token: token);
|
await db.InsertAsync(ann, token: token);
|
||||||
}
|
}
|
||||||
|
await db.BulkCopyAsync(detections, cancellationToken: token);
|
||||||
return ann;
|
return ann;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ public class GalleryService(
|
|||||||
await _updateLock.WaitAsync();
|
await _updateLock.WaitAsync();
|
||||||
var existingAnnotations = new ConcurrentDictionary<string, Annotation>(await dbFactory.Run(async db =>
|
var existingAnnotations = new ConcurrentDictionary<string, Annotation>(await dbFactory.Run(async db =>
|
||||||
await db.Annotations.ToDictionaryAsync(x => x.Name)));
|
await db.Annotations.ToDictionaryAsync(x => x.Name)));
|
||||||
var missedAnnotations = new ConcurrentBag<Annotation>();
|
var missedAnnotations = new ConcurrentDictionary<string, Annotation>();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var prefixLen = Constants.THUMBNAIL_PREFIX.Length;
|
var prefixLen = Constants.THUMBNAIL_PREFIX.Length;
|
||||||
@@ -89,7 +89,7 @@ public class GalleryService(
|
|||||||
|
|
||||||
await ParallelExt.ForEachAsync(files, async (file, cancellationToken) =>
|
await ParallelExt.ForEachAsync(files, async (file, cancellationToken) =>
|
||||||
{
|
{
|
||||||
var fName = Path.GetFileNameWithoutExtension(file.Name);
|
var fName = file.Name.ToFName();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var labelName = Path.Combine(_dirConfig.LabelsDirectory, $"{fName}.txt");
|
var labelName = Path.Combine(_dirConfig.LabelsDirectory, $"{fName}.txt");
|
||||||
@@ -136,7 +136,7 @@ public class GalleryService(
|
|||||||
{
|
{
|
||||||
Time = time,
|
Time = time,
|
||||||
OriginalMediaName = originalMediaName,
|
OriginalMediaName = originalMediaName,
|
||||||
Name = file.Name.ToFName(),
|
Name = fName,
|
||||||
ImageExtension = Path.GetExtension(file.Name),
|
ImageExtension = Path.GetExtension(file.Name),
|
||||||
Detections = detections,
|
Detections = detections,
|
||||||
CreatedDate = File.GetCreationTimeUtc(file.FullName),
|
CreatedDate = File.GetCreationTimeUtc(file.FullName),
|
||||||
@@ -146,8 +146,15 @@ public class GalleryService(
|
|||||||
AnnotationStatus = AnnotationStatus.Validated
|
AnnotationStatus = AnnotationStatus.Validated
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//Remove duplicates
|
||||||
if (!existingAnnotations.ContainsKey(fName))
|
if (!existingAnnotations.ContainsKey(fName))
|
||||||
missedAnnotations.Add(annotation);
|
{
|
||||||
|
if (missedAnnotations.ContainsKey(fName))
|
||||||
|
Console.WriteLine($"{fName} is already exists! Duplicate!");
|
||||||
|
else
|
||||||
|
missedAnnotations.TryAdd(fName, annotation);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!thumbnails.Contains(fName))
|
if (!thumbnails.Contains(fName))
|
||||||
await CreateThumbnail(annotation, cancellationToken);
|
await CreateThumbnail(annotation, cancellationToken);
|
||||||
@@ -181,10 +188,20 @@ public class GalleryService(
|
|||||||
{
|
{
|
||||||
MaxBatchSize = 50
|
MaxBatchSize = 50
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//Db could be updated during the long files scraping
|
||||||
|
existingAnnotations = new ConcurrentDictionary<string, Annotation>(await dbFactory.Run(async db =>
|
||||||
|
await db.Annotations.ToDictionaryAsync(x => x.Name)));
|
||||||
|
var insertedDuplicates = missedAnnotations.Where(x => existingAnnotations.ContainsKey(x.Key)).ToList();
|
||||||
|
var annotationsToInsert = missedAnnotations
|
||||||
|
.Where(a => !existingAnnotations.ContainsKey(a.Key))
|
||||||
|
.Select(x => x.Value)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
await dbFactory.Run(async db =>
|
await dbFactory.Run(async db =>
|
||||||
{
|
{
|
||||||
await db.BulkCopyAsync(copyOptions, missedAnnotations);
|
await db.BulkCopyAsync(copyOptions, annotationsToInsert);
|
||||||
await db.BulkCopyAsync(copyOptions, missedAnnotations.SelectMany(x => x.Detections));
|
await db.BulkCopyAsync(copyOptions, annotationsToInsert.SelectMany(x => x.Detections));
|
||||||
});
|
});
|
||||||
dbFactory.SaveToDisk();
|
dbFactory.SaveToDisk();
|
||||||
_updateLock.Release();
|
_updateLock.Release();
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Threading;
|
||||||
using Azaion.Common.DTO;
|
using Azaion.Common.DTO;
|
||||||
using Azaion.Common.DTO.Queue;
|
using Azaion.Common.DTO.Queue;
|
||||||
using Azaion.Common.Events;
|
using Azaion.Common.Events;
|
||||||
@@ -102,6 +103,8 @@ public class DatasetExplorerEventHandler(
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async Task Handle(AnnotationCreatedEvent notification, CancellationToken cancellationToken)
|
public async Task Handle(AnnotationCreatedEvent notification, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
datasetExplorer.Dispatcher.Invoke(async () =>
|
||||||
{
|
{
|
||||||
var annotation = notification.Annotation;
|
var annotation = notification.Annotation;
|
||||||
var selectedClass = datasetExplorer.LvClasses.CurrentClassNumber;
|
var selectedClass = datasetExplorer.LvClasses.CurrentClassNumber;
|
||||||
@@ -122,7 +125,7 @@ public class DatasetExplorerEventHandler(
|
|||||||
datasetExplorer.SelectedAnnotations.Insert(0, annThumb);
|
datasetExplorer.SelectedAnnotations.Insert(0, annThumb);
|
||||||
datasetExplorer.SelectedAnnotationDict.Add(annThumb.Annotation.Name, annThumb);
|
datasetExplorer.SelectedAnnotationDict.Add(annThumb.Annotation.Name, annThumb);
|
||||||
}
|
}
|
||||||
await Task.CompletedTask;
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task Handle(AnnotationsDeletedEvent notification, CancellationToken cancellationToken)
|
public async Task Handle(AnnotationsDeletedEvent notification, CancellationToken cancellationToken)
|
||||||
|
|||||||
@@ -173,7 +173,9 @@ public partial class App
|
|||||||
services.AddSingleton<IResourceLoader>(_resourceLoader);
|
services.AddSingleton<IResourceLoader>(_resourceLoader);
|
||||||
services.AddSingleton<IAuthProvider>(_authProvider);
|
services.AddSingleton<IAuthProvider>(_authProvider);
|
||||||
services.AddSingleton<IInferenceService, InferenceService>();
|
services.AddSingleton<IInferenceService, InferenceService>();
|
||||||
|
services.AddSingleton<IGpsMatcherService, GpsMatcherService>();
|
||||||
|
services.AddSingleton<ISatelliteDownloader, SatelliteDownloader>();
|
||||||
|
services.AddHttpClient();
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
services.AddSingleton<IConfigUpdater, ConfigUpdater>();
|
services.AddSingleton<IConfigUpdater, ConfigUpdater>();
|
||||||
|
|||||||
@@ -9,7 +9,19 @@ call upload-file %FILE1_TO_UPLOAD% %RESOURCES_FOLDER%
|
|||||||
set FILE2_TO_UPLOAD=%cd%\..\Azaion.Dataset\bin\%CONFIG%\net8.0-windows\Azaion.Dataset.dll
|
set FILE2_TO_UPLOAD=%cd%\..\Azaion.Dataset\bin\%CONFIG%\net8.0-windows\Azaion.Dataset.dll
|
||||||
call upload-file %FILE2_TO_UPLOAD% %RESOURCES_FOLDER%
|
call upload-file %FILE2_TO_UPLOAD% %RESOURCES_FOLDER%
|
||||||
|
|
||||||
set DESTINATION=%cd%\bin\Debug\net8.0-windows\gps-denied
|
set SUITE_FOLDER=%cd%\bin\%CONFIG%\net8.0-windows\
|
||||||
|
|
||||||
|
rem Inference
|
||||||
|
|
||||||
|
set INFERENCE_PATH=%cd%\..\Azaion.Inference
|
||||||
|
xcopy /E %INFERENCE_PATH%\dist\azaion-inference %SUITE_FOLDER%
|
||||||
|
copy %INFERENCE_PATH%\venv\Lib\site-packages\tensorrt_libs\nvinfer_10.dll %SUITE_FOLDER%
|
||||||
|
copy %INFERENCE_PATH%\venv\Lib\site-packages\tensorrt_libs\nvinfer_plugin_10.dll %SUITE_FOLDER%
|
||||||
|
copy %INFERENCE_PATH%\venv\Lib\site-packages\tensorrt_libs\nvonnxparser_10.dll %SUITE_FOLDER%
|
||||||
|
copy %INFERENCE_PATH%\config.yaml %SUITE_FOLDER%
|
||||||
|
|
||||||
|
rem Gps Denied
|
||||||
|
set DESTINATION=%SUITE_FOLDER%\gps-denied
|
||||||
set GPS_DENIED=%cd%\..\..\gps-denied\
|
set GPS_DENIED=%cd%\..\..\gps-denied\
|
||||||
|
|
||||||
rmdir %DESTINATION% /s /q
|
rmdir %DESTINATION% /s /q
|
||||||
|
|||||||
Reference in New Issue
Block a user