mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 13:26:30 +00:00
fix detection label
fix schema migrator for enums
This commit is contained in:
@@ -5,7 +5,7 @@ using System.Windows.Media;
|
||||
using System.Windows.Shapes;
|
||||
using Azaion.Common.DTO;
|
||||
using Azaion.Common.Extensions;
|
||||
using Label = System.Windows.Controls.Label;
|
||||
using Annotation = Azaion.Common.Database.Annotation;
|
||||
|
||||
namespace Azaion.Common.Controls;
|
||||
|
||||
@@ -94,7 +94,8 @@ public class DetectionControl : Border
|
||||
};
|
||||
_detectionLabelPanel = new DetectionLabelPanel
|
||||
{
|
||||
Confidence = canvasLabel.Confidence
|
||||
Confidence = canvasLabel.Confidence,
|
||||
DetectionClass = Annotation.DetectionClassesDict[canvasLabel.ClassNumber]
|
||||
};
|
||||
|
||||
DetectionLabelContainer.Children.Add(_detectionLabelPanel);
|
||||
|
||||
@@ -47,13 +47,13 @@
|
||||
</DrawingImage>
|
||||
</UserControl.Resources>
|
||||
|
||||
<Grid>
|
||||
<Grid x:Name="DetectionGrid">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="28"></ColumnDefinition>
|
||||
<ColumnDefinition Width="2"></ColumnDefinition>
|
||||
<ColumnDefinition Width="Auto"></ColumnDefinition>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Image Grid.Column="0" x:Name="AffiliationImage">
|
||||
</Image>
|
||||
<Label Grid.Column="1" FontSize="16"></Label>
|
||||
<Label Grid.Column="1" x:Name="DetectionClassName" FontSize="16"></Label>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -1,12 +1,12 @@
|
||||
using System.Windows.Media;
|
||||
using Azaion.Common.DTO;
|
||||
using Azaion.Common.Extensions;
|
||||
|
||||
namespace Azaion.Common.Controls
|
||||
{
|
||||
public partial class DetectionLabelPanel
|
||||
{
|
||||
private AffiliationEnum _affiliation = AffiliationEnum.None;
|
||||
private double _confidence;
|
||||
|
||||
public AffiliationEnum Affiliation
|
||||
{
|
||||
@@ -18,18 +18,33 @@ namespace Azaion.Common.Controls
|
||||
}
|
||||
}
|
||||
|
||||
public DetectionClass DetectionClass { get; set; }
|
||||
private DetectionClass _detectionClass = new();
|
||||
public DetectionClass DetectionClass {
|
||||
get => _detectionClass;
|
||||
set
|
||||
{
|
||||
_detectionClass = value;
|
||||
SetClassName();
|
||||
}
|
||||
}
|
||||
|
||||
private double _confidence;
|
||||
public double Confidence
|
||||
{
|
||||
get => _confidence;
|
||||
set
|
||||
{
|
||||
_confidence = value;
|
||||
|
||||
SetClassName();
|
||||
}
|
||||
}
|
||||
|
||||
private void SetClassName()
|
||||
{
|
||||
DetectionClassName.Content = _confidence >= 0.995 ? _detectionClass.UIName : $"{_detectionClass.UIName}: {_confidence * 100:F0}%";
|
||||
DetectionGrid.Background = new SolidColorBrush(_detectionClass.Color.ToConfidenceColor(_confidence));
|
||||
}
|
||||
|
||||
public DetectionLabelPanel()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
Reference in New Issue
Block a user