mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 10:26:31 +00:00
add MediaHash. Step1
This commit is contained in:
@@ -258,12 +258,13 @@ public partial class DatasetExplorer
|
||||
private async Task ReloadThumbnails()
|
||||
{
|
||||
var withDetectionsOnly = ShowWithObjectsOnlyChBox.IsChecked;
|
||||
var currentUser = await _azaionApi.GetCurrentUserAsync();
|
||||
SelectedAnnotations.Clear();
|
||||
SelectedAnnotationDict.Clear();
|
||||
var annThumbnails = _annotationsDict[ExplorerEditor.CurrentAnnClass.YoloId]
|
||||
var annThumbnails = _annotationsDict[ExplorerEditor.CurrentAnnClass!.YoloId]
|
||||
.WhereIf(withDetectionsOnly, x => x.Value.Detections.Any())
|
||||
.WhereIf(!string.IsNullOrEmpty(CurrentFilter), x => x.Key.Contains(CurrentFilter, StringComparison.CurrentCultureIgnoreCase))
|
||||
.Select(x => new AnnotationThumbnail(x.Value, _azaionApi.CurrentUser.Role.IsValidator()))
|
||||
.Select(x => new AnnotationThumbnail(x.Value, currentUser.Role.IsValidator()))
|
||||
.OrderBy(x => !x.IsSeed)
|
||||
.ThenByDescending(x =>x.Annotation.CreatedDate);
|
||||
|
||||
@@ -272,7 +273,6 @@ public partial class DatasetExplorer
|
||||
SelectedAnnotations.Add(thumb);
|
||||
SelectedAnnotationDict.Add(thumb.Annotation.Name, thumb);
|
||||
}
|
||||
await Task.CompletedTask;
|
||||
}
|
||||
|
||||
private async void ValidateAnnotationsClick(object sender, RoutedEventArgs e)
|
||||
|
||||
@@ -72,7 +72,7 @@ public class DatasetExplorerEventHandler(
|
||||
.Select(x => new Detection(a.Name, x.ToYoloLabel(datasetExplorer.ExplorerEditor.RenderSize, mediaSize)))
|
||||
.ToList();
|
||||
var index = datasetExplorer.ThumbnailsView.SelectedIndex;
|
||||
var annotation = await annotationService.SaveAnnotation(a.OriginalMediaName, a.Name, a.Time, detections, token: token);
|
||||
var annotation = await annotationService.SaveAnnotation(a.MediaHash, a.OriginalMediaName, a.Name, a.Time, detections, token: token);
|
||||
await ValidateAnnotations([annotation], token);
|
||||
await datasetExplorer.EditAnnotation(index + 1);
|
||||
break;
|
||||
@@ -119,9 +119,9 @@ public class DatasetExplorerEventHandler(
|
||||
}
|
||||
}
|
||||
|
||||
public Task Handle(AnnotationCreatedEvent notification, CancellationToken token)
|
||||
public async Task Handle(AnnotationCreatedEvent notification, CancellationToken token)
|
||||
{
|
||||
datasetExplorer.Dispatcher.Invoke(() =>
|
||||
await datasetExplorer.Dispatcher.Invoke(async () =>
|
||||
{
|
||||
var annotation = notification.Annotation;
|
||||
var selectedClass = datasetExplorer.LvClasses.CurrentClassNumber;
|
||||
@@ -131,7 +131,8 @@ public class DatasetExplorerEventHandler(
|
||||
return;
|
||||
|
||||
var index = 0;
|
||||
var annThumb = new AnnotationThumbnail(annotation, azaionApi.CurrentUser.Role.IsValidator());
|
||||
var currentUser = await azaionApi.GetCurrentUserAsync();
|
||||
var annThumb = new AnnotationThumbnail(annotation, currentUser.Role.IsValidator());
|
||||
if (datasetExplorer.SelectedAnnotationDict.ContainsKey(annThumb.Annotation.Name))
|
||||
{
|
||||
datasetExplorer.SelectedAnnotationDict.Remove(annThumb.Annotation.Name);
|
||||
@@ -146,7 +147,6 @@ public class DatasetExplorerEventHandler(
|
||||
datasetExplorer.SelectedAnnotations.Insert(index, annThumb);
|
||||
datasetExplorer.SelectedAnnotationDict.Add(annThumb.Annotation.Name, annThumb);
|
||||
});
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public async Task Handle(AnnotationsDeletedEvent notification, CancellationToken token)
|
||||
|
||||
Reference in New Issue
Block a user