mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 23:46:30 +00:00
make thumbnail generating multithread
fix the bug with open video add class distribution chart
This commit is contained in:
@@ -248,25 +248,25 @@ public partial class MainWindow
|
||||
foreach (var file in labelFiles)
|
||||
{
|
||||
var name = Path.GetFileNameWithoutExtension(file.Name);
|
||||
var time = _formState.GetTime(name)!.Value;
|
||||
|
||||
var time = _formState.GetTime(name);
|
||||
await AddAnnotation(time, await YoloLabel.ReadFromFile(file.FullName));
|
||||
}
|
||||
}
|
||||
|
||||
public async Task AddAnnotation(TimeSpan time, List<YoloLabel> annotations)
|
||||
public async Task AddAnnotation(TimeSpan? time, List<YoloLabel> annotations)
|
||||
{
|
||||
var fName = _formState.GetTimeName(time);
|
||||
|
||||
var previousAnnotations = Annotations.Query(time);
|
||||
var timeValue = time ?? TimeSpan.FromMinutes(0);
|
||||
var previousAnnotations = Annotations.Query(timeValue);
|
||||
Annotations.Remove(previousAnnotations);
|
||||
Annotations.Add(time.Subtract(_thresholdBefore), time.Add(_thresholdAfter), annotations);
|
||||
Annotations.Add(timeValue.Subtract(_thresholdBefore), timeValue.Add(_thresholdAfter), annotations);
|
||||
|
||||
var existingResult = _formState.AnnotationResults.FirstOrDefault(x => x.Time == time);
|
||||
if (existingResult != null)
|
||||
_formState.AnnotationResults.Remove(existingResult);
|
||||
|
||||
_formState.AnnotationResults.Add(new AnnotationResult(time, fName, annotations, _config));
|
||||
_formState.AnnotationResults.Add(new AnnotationResult(timeValue, fName, annotations, _config));
|
||||
await File.WriteAllTextAsync($"{_config.ResultsDirectory}/{fName}.json", JsonConvert.SerializeObject(_formState.AnnotationResults));
|
||||
}
|
||||
|
||||
@@ -277,7 +277,13 @@ public partial class MainWindow
|
||||
return;
|
||||
|
||||
var labelNames = new DirectoryInfo(_config.LabelsDirectory).GetFiles()
|
||||
.Select(x => x.Name[..^11])
|
||||
.Select(x =>
|
||||
{
|
||||
var name = Path.GetFileNameWithoutExtension(x.Name);
|
||||
return name.Length > 8
|
||||
? name[..^7]
|
||||
: name;
|
||||
})
|
||||
.GroupBy(x => x)
|
||||
.Select(gr => gr.Key)
|
||||
.ToDictionary(x => x);
|
||||
|
||||
Reference in New Issue
Block a user