mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 11:16:30 +00:00
fix initialization, throttle operations
day/winter/night switcher fixes
This commit is contained in:
@@ -51,7 +51,7 @@ public partial class Annotator
|
||||
|
||||
private readonly TimeSpan _thresholdBefore = TimeSpan.FromMilliseconds(100);
|
||||
private readonly TimeSpan _thresholdAfter = TimeSpan.FromMilliseconds(300);
|
||||
|
||||
private static readonly Guid SaveConfigTaskId = Guid.NewGuid();
|
||||
|
||||
public ObservableCollection<MediaFileInfo> AllMediaFiles { get; set; } = new();
|
||||
public ObservableCollection<MediaFileInfo> FilteredMediaFiles { get; set; } = new();
|
||||
@@ -72,6 +72,7 @@ public partial class Annotator
|
||||
IInferenceService inferenceService)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
_appConfig = appConfig.Value;
|
||||
_configUpdater = configUpdater;
|
||||
_libVLC = libVLC;
|
||||
@@ -119,9 +120,7 @@ public partial class Annotator
|
||||
_suspendLayout = false;
|
||||
TbFolder.Text = _appConfig.DirectoriesConfig.VideosDirectory;
|
||||
|
||||
AnnotationClasses = new ObservableCollection<DetectionClass>(_appConfig.AnnotationConfig.AnnotationClasses);
|
||||
LvClasses.DetectionDataGrid.ItemsSource = AnnotationClasses;
|
||||
LvClasses.SelectNum(0);
|
||||
LvClasses.Init(_appConfig.AnnotationConfig.DetectionClasses);
|
||||
|
||||
if (LvFiles.Items.IsEmpty)
|
||||
BlinkHelp(HelpTexts.HelpTextsDict[HelpTextEnum.Initial]);
|
||||
@@ -261,7 +260,7 @@ public partial class Annotator
|
||||
{
|
||||
_configUpdater.Save(_appConfig);
|
||||
return Task.CompletedTask;
|
||||
}, TimeSpan.FromSeconds(5));
|
||||
}, SaveConfigTaskId, TimeSpan.FromSeconds(5));
|
||||
}
|
||||
|
||||
private void ShowTimeAnnotations(TimeSpan time)
|
||||
@@ -295,7 +294,7 @@ public partial class Annotator
|
||||
}
|
||||
foreach (var detection in annotation.Detections)
|
||||
{
|
||||
var annClass = _appConfig.AnnotationConfig.AnnotationClasses[detection.ClassNumber];
|
||||
var annClass = _appConfig.AnnotationConfig.DetectionClasses[detection.ClassNumber];
|
||||
var canvasLabel = new CanvasLabel(detection, canvasSize, videoSize, detection.Probability);
|
||||
Editor.CreateDetectionControl(annClass, annotation.Time, canvasLabel);
|
||||
}
|
||||
@@ -312,6 +311,7 @@ public partial class Annotator
|
||||
var annotations = await _dbFactory.Run(async db =>
|
||||
await db.Annotations.LoadWith(x => x.Detections)
|
||||
.Where(x => x.OriginalMediaName == _formState.VideoName)
|
||||
.OrderBy(x => x.Time)
|
||||
.ToListAsync(token: MainCancellationSource.Token));
|
||||
|
||||
TimedAnnotations.Clear();
|
||||
@@ -425,12 +425,6 @@ public partial class Annotator
|
||||
private void SeekTo(TimeSpan time) =>
|
||||
SeekTo((long)time.TotalMilliseconds);
|
||||
|
||||
// private void AddClassBtnClick(object sender, RoutedEventArgs e)
|
||||
// {
|
||||
// LvClasses.IsReadOnly = false;
|
||||
// DetectionClasses.Add(new DetectionClass(DetectionClasses.Count));
|
||||
// LvClasses.SelectedIndex = DetectionClasses.Count - 1;
|
||||
// }
|
||||
private async void OpenFolderItemClick(object sender, RoutedEventArgs e) => await OpenFolder();
|
||||
private async void OpenFolderButtonClick(object sender, RoutedEventArgs e) => await OpenFolder();
|
||||
|
||||
@@ -521,8 +515,8 @@ public partial class Annotator
|
||||
{
|
||||
//Take not annotataed medias
|
||||
files = (LvFiles.ItemsSource as IEnumerable<MediaFileInfo>)?.Skip(LvFiles.SelectedIndex)
|
||||
.Take(Constants.DETECTION_BATCH_SIZE)
|
||||
.Where(x => !x.HasAnnotations)
|
||||
.Take(Constants.DETECTION_BATCH_SIZE)
|
||||
.Select(x => x.Path)
|
||||
.ToList() ?? [];
|
||||
if (files.Count != 0)
|
||||
|
||||
Reference in New Issue
Block a user