fix inference

fix small issues
This commit is contained in:
Alex Bezdieniezhnykh
2025-02-14 09:00:04 +02:00
parent cfd5483a18
commit 961d2499de
15 changed files with 42 additions and 29 deletions
+11 -6
View File
@@ -520,21 +520,26 @@ public partial class Annotator
var files = new List<string>();
await Dispatcher.Invoke(async () =>
{
//Take not annotated medias
files = (LvFiles.ItemsSource as IEnumerable<MediaFileInfo>)?.Skip(LvFiles.SelectedIndex)
.Take(Constants.DETECTION_BATCH_SIZE)
.Where(x => !x.HasAnnotations)
.Select(x => x.Path)
.ToList();
await _mediator.Publish(new AnnotatorControlEvent(PlaybackControlEnum.Play), ct);
await ReloadAnnotations();
.ToList() ?? [];
if (files.Count != 0)
{
await _mediator.Publish(new AnnotatorControlEvent(PlaybackControlEnum.Play), ct);
await ReloadAnnotations();
}
});
if (files.Count == 0)
break;
await _inferenceService.RunInference(files, async annotationImage => await ProcessDetection(annotationImage), ct);
Dispatcher.Invoke(() =>
{
if (LvFiles.SelectedIndex + files.Count >= LvFiles.Items.Count)
DetectionCancellationSource.Cancel();
LvFiles.SelectedIndex += files.Count;
LvFiles.Items.Refresh();
});