fix bug with annotation result gradient stops

add tensorrt engine
This commit is contained in:
Alex Bezdieniezhnykh
2025-04-02 00:29:21 +03:00
parent e0c88bd8fb
commit b21f8e320f
36 changed files with 544 additions and 206 deletions
+15 -11
View File
@@ -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);