mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 10:16:30 +00:00
fix bug with annotation result gradient stops
add tensorrt engine
This commit is contained in:
@@ -77,11 +77,11 @@ public partial class DatasetExplorer
|
||||
await DeleteAnnotations();
|
||||
break;
|
||||
case Key.Enter:
|
||||
await EditAnnotation();
|
||||
await EditAnnotation(ThumbnailsView.SelectedIndex);
|
||||
break;
|
||||
}
|
||||
};
|
||||
ThumbnailsView.MouseDoubleClick += async (_, _) => await EditAnnotation();
|
||||
ThumbnailsView.MouseDoubleClick += async (_, _) => await EditAnnotation(ThumbnailsView.SelectedIndex);
|
||||
|
||||
ThumbnailsView.SelectionChanged += (_, _) =>
|
||||
{
|
||||
@@ -152,7 +152,7 @@ public partial class DatasetExplorer
|
||||
.Select(gr => new
|
||||
{
|
||||
gr.Key,
|
||||
_annotationConfig.DetectionClassesDict[gr.Key].Name,
|
||||
_annotationConfig.DetectionClassesDict[gr.Key].ShortName,
|
||||
_annotationConfig.DetectionClassesDict[gr.Key].Color,
|
||||
ClassCount = gr.Value.Count
|
||||
})
|
||||
@@ -175,7 +175,7 @@ public partial class DatasetExplorer
|
||||
|
||||
foreach (var x in data)
|
||||
{
|
||||
var label = ClassDistribution.Plot.Add.Text(x.Name, 50, -1.5 * x.Key + 1.1);
|
||||
var label = ClassDistribution.Plot.Add.Text(x.ShortName, 50, -1.5 * x.Key + 1.1);
|
||||
label.LabelFontColor = foregroundColor;
|
||||
label.LabelFontSize = 18;
|
||||
}
|
||||
@@ -204,16 +204,17 @@ public partial class DatasetExplorer
|
||||
RefreshThumbnailsButtonItem.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
private async Task EditAnnotation()
|
||||
public async Task EditAnnotation(int index)
|
||||
{
|
||||
try
|
||||
{
|
||||
ThumbnailLoading = true;
|
||||
|
||||
if (ThumbnailsView.SelectedItem == null)
|
||||
if (index == -1)
|
||||
return;
|
||||
|
||||
CurrentAnnotation = (ThumbnailsView.SelectedItem as AnnotationThumbnail)!;
|
||||
CurrentAnnotation = (ThumbnailsView.Items[index] as AnnotationThumbnail)!;
|
||||
ThumbnailsView.SelectedIndex = index;
|
||||
|
||||
var ann = CurrentAnnotation.Annotation;
|
||||
ExplorerEditor.Background = new ImageBrush
|
||||
{
|
||||
@@ -224,7 +225,6 @@ public partial class DatasetExplorer
|
||||
var time = ann.Time;
|
||||
ExplorerEditor.RemoveAllAnns();
|
||||
ExplorerEditor.CreateDetections(time, ann.Detections, _annotationConfig.DetectionClasses, ExplorerEditor.RenderSize);
|
||||
ThumbnailLoading = false;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -233,7 +233,11 @@ public partial class DatasetExplorer
|
||||
}
|
||||
finally
|
||||
{
|
||||
ThumbnailLoading = false;
|
||||
_ = Task.Run(async () =>
|
||||
{
|
||||
await Task.Delay(100);
|
||||
ThumbnailLoading = false;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -260,7 +264,7 @@ public partial class DatasetExplorer
|
||||
}
|
||||
}
|
||||
|
||||
private async Task DeleteAnnotations()
|
||||
public async Task DeleteAnnotations()
|
||||
{
|
||||
var tempSelected = ThumbnailsView.SelectedIndex;
|
||||
var result = MessageBox.Show("Чи дійсно видалити аннотації?","Підтвердження видалення", MessageBoxButton.YesNo, MessageBoxImage.Question);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.IO;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using Azaion.Common.DTO;
|
||||
using Azaion.Common.DTO.Queue;
|
||||
@@ -22,7 +23,9 @@ public class DatasetExplorerEventHandler(
|
||||
{ Key.Delete, PlaybackControlEnum.RemoveSelectedAnns },
|
||||
{ Key.X, PlaybackControlEnum.RemoveAllAnns },
|
||||
{ Key.Escape, PlaybackControlEnum.Close },
|
||||
{ Key.V, PlaybackControlEnum.ValidateAnnotations}
|
||||
{ Key.Down, PlaybackControlEnum.Next },
|
||||
{ Key.Up, PlaybackControlEnum.Previous },
|
||||
{ Key.V, PlaybackControlEnum.ValidateAnnotations},
|
||||
};
|
||||
|
||||
public async Task Handle(DatasetExplorerControlEvent notification, CancellationToken cancellationToken)
|
||||
@@ -63,15 +66,28 @@ public class DatasetExplorerEventHandler(
|
||||
var detections = datasetExplorer.ExplorerEditor.CurrentDetections
|
||||
.Select(x => new Detection(a.Name, x.GetLabel(datasetExplorer.ExplorerEditor.RenderSize)))
|
||||
.ToList();
|
||||
var index = datasetExplorer.ThumbnailsView.SelectedIndex;
|
||||
await annotationService.SaveAnnotation(a.OriginalMediaName, a.Time, detections, SourceEnum.Manual, token: cancellationToken);
|
||||
datasetExplorer.SwitchTab(toEditor: false);
|
||||
await datasetExplorer.EditAnnotation(index + 1);
|
||||
break;
|
||||
case PlaybackControlEnum.RemoveSelectedAnns:
|
||||
datasetExplorer.ExplorerEditor.RemoveSelectedAnns();
|
||||
if (datasetExplorer.ExplorerEditor.CurrentDetections.Any(x => x.IsSelected))
|
||||
datasetExplorer.ExplorerEditor.RemoveSelectedAnns();
|
||||
else
|
||||
{
|
||||
await datasetExplorer.DeleteAnnotations();
|
||||
await datasetExplorer.EditAnnotation(datasetExplorer.ThumbnailsView.SelectedIndex);
|
||||
}
|
||||
break;
|
||||
case PlaybackControlEnum.RemoveAllAnns:
|
||||
datasetExplorer.ExplorerEditor.RemoveAllAnns();
|
||||
break;
|
||||
case PlaybackControlEnum.Next:
|
||||
await datasetExplorer.EditAnnotation(datasetExplorer.ThumbnailsView.SelectedIndex + 1);
|
||||
break;
|
||||
case PlaybackControlEnum.Previous:
|
||||
await datasetExplorer.EditAnnotation(datasetExplorer.ThumbnailsView.SelectedIndex - 1);
|
||||
break;
|
||||
case PlaybackControlEnum.Close:
|
||||
datasetExplorer.SwitchTab(toEditor: false);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user