修改框架(未完全完成)实现单个相机分开绑定算法
This commit is contained in:
		| @@ -1,4 +1,14 @@ | ||||
| using Check.Main.Common; | ||||
| //using Check.Main.Common; | ||||
| //using System; | ||||
| //using System.Collections.Generic; | ||||
| //using System.ComponentModel;// 需要引入此命名空间以使用 INotifyPropertyChanged | ||||
| //using System.Linq; | ||||
| //using System.Runtime.CompilerServices; | ||||
| //using System.Runtime.Serialization; | ||||
| //using System.Text; | ||||
| //using System.Threading.Tasks; | ||||
|  | ||||
| using Check.Main.Common; | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.ComponentModel; | ||||
| @@ -7,28 +17,12 @@ using System.Runtime.CompilerServices; | ||||
| using System.Runtime.Serialization; | ||||
| using System.Text; | ||||
| using System.Threading.Tasks; | ||||
| using System.Windows.Forms.Design; | ||||
| using System.Drawing.Design; | ||||
|  | ||||
| namespace Check.Main.Infer | ||||
| { | ||||
|     public enum DetectDevice | ||||
|     { | ||||
|         [Description("CPU")] | ||||
|         CPU = 0, | ||||
|  | ||||
|         [Description("GPU")] | ||||
|         GPU, | ||||
|  | ||||
|         //[Description("VPU")] | ||||
|         //VPU, | ||||
|     } | ||||
|     public enum AlgorithmType | ||||
|     { | ||||
|         [Description("传统算法")] | ||||
|         Tradition = 0, | ||||
|  | ||||
|         [Description("深度学习")] | ||||
|         DeepLearning, | ||||
|     } | ||||
|     public enum CheckModelType | ||||
|     { | ||||
|         [Description("分类")] | ||||
| @@ -47,9 +41,32 @@ namespace Check.Main.Infer | ||||
|         PoseEstimation | ||||
|     } | ||||
|  | ||||
|     [Serializable] // 确保可被XML序列化 | ||||
|     public class ModelSettings : INotifyPropertyChanged, ICloneable | ||||
|     public enum AlgorithmType | ||||
|     { | ||||
|         [Description("传统算法")] | ||||
|         Tradition = 0, | ||||
|  | ||||
|         [Description("深度学习")] | ||||
|         DeepLearning, | ||||
|     } | ||||
|  | ||||
|     public enum DetectDevice | ||||
|     { | ||||
|         [Description("CPU")] | ||||
|         CPU = 0, | ||||
|  | ||||
|         [Description("GPU")] | ||||
|         GPU, | ||||
|  | ||||
|         //[Description("VPU")] | ||||
|         //VPU, | ||||
|     } | ||||
|     | ||||
|  | ||||
|     [Serializable] // 确保可被XML序列化 | ||||
|     public class ModelSettings : INotifyPropertyChanged, ICloneable//类ModelSettings继承或实现两个接口:①提供一个事件,用于在属性值更改时发出通知;②提供一个方法,用于创建对象的独立副本 | ||||
|     { | ||||
|         //1. 实现 INotifyPropertyChanged 接口 | ||||
|         public event PropertyChangedEventHandler PropertyChanged; | ||||
|  | ||||
|         private int _id; | ||||
| @@ -57,9 +74,14 @@ namespace Check.Main.Infer | ||||
|         private string _path = ""; | ||||
|         private DetectDevice _checkDevice=DetectDevice.CPU; | ||||
|         private AlgorithmType _mAType = AlgorithmType.Tradition; | ||||
|         private CheckModelType _mType = CheckModelType.Classification; | ||||
|         private CheckModelType _mType = CheckModelType.ObjectDetection; | ||||
|         private bool _isEnabled = true; | ||||
|  | ||||
|         // 新增 HALCON 和 YOLO 的参数。10.22 | ||||
|         private double _halconScoreThreshold = 0.5; | ||||
|         private float _yoloConfidenceThreshold = 0.25f; | ||||
|         private float _yoloNmsThreshold = 0.45f; | ||||
|  | ||||
|         [Category("基本信息"), DisplayName("模型编号"), Description("模型的唯一标识符,用于与相机编号对应。")] | ||||
|         public int Id | ||||
|         { | ||||
| @@ -73,13 +95,6 @@ namespace Check.Main.Infer | ||||
|             get => _name; | ||||
|             set { if (_name != value) { _name = value; OnPropertyChanged(); } } | ||||
|         } | ||||
|         [Category("基本信息"), DisplayName("推理设备"), Description("推理模型的设备。")] | ||||
|         [TypeConverter(typeof(EnumDescriptionTypeConverter))] | ||||
|         public DetectDevice CheckDevice | ||||
|         { | ||||
|             get => _checkDevice; | ||||
|             set { if (_checkDevice != value) { _checkDevice = value; OnPropertyChanged(); } } | ||||
|         } | ||||
|  | ||||
|         [Category("基本信息"), DisplayName("算法类型"), Description("所使用的算法的类型。")] | ||||
|         [TypeConverter(typeof(EnumDescriptionTypeConverter))] | ||||
| @@ -88,6 +103,16 @@ namespace Check.Main.Infer | ||||
|             get => _mAType; | ||||
|             set { if (_mAType != value) { _mAType = value; OnPropertyChanged(); } } | ||||
|         } | ||||
|  | ||||
|         [Category("基本信息"), DisplayName("推理设备"), Description("推理模型的设备。")] | ||||
|         [TypeConverter(typeof(EnumDescriptionTypeConverter))] | ||||
|         public DetectDevice CheckDevice | ||||
|         { | ||||
|             get => _checkDevice; | ||||
|             set { if (_checkDevice != value) { _checkDevice = value; OnPropertyChanged(); } } | ||||
|         } | ||||
|  | ||||
|  | ||||
|         [Category("基本信息"), DisplayName("模型类型"), Description("推理模型的类型。")] | ||||
|         [TypeConverter(typeof(EnumDescriptionTypeConverter))] | ||||
|         public CheckModelType MType | ||||
| @@ -96,18 +121,18 @@ namespace Check.Main.Infer | ||||
|             set { if (_mType != value) { _mType = value; OnPropertyChanged(); } } | ||||
|         } | ||||
|  | ||||
|  | ||||
|         [Category("基本信息"), DisplayName("是否启用"), Description("是否在程序启动时是否启用模型")] | ||||
|         public bool IsEnabled | ||||
|         { | ||||
|             get => _isEnabled; | ||||
|             set | ||||
|             { | ||||
|                 if (_isEnabled != value) | ||||
|                 { | ||||
|                     _isEnabled = value; | ||||
|                     OnPropertyChanged(); | ||||
|                 } | ||||
|             } | ||||
|             set  {  | ||||
|                         if (_isEnabled != value) | ||||
|                         { | ||||
|                             _isEnabled = value; | ||||
|                             OnPropertyChanged(); | ||||
|                         } | ||||
|                    } | ||||
|         } | ||||
|  | ||||
|         [Category("文件"), DisplayName("模型路径"), Description("选择模型文件(.onnx, .bin, etc., .pt)。")] | ||||
| @@ -118,6 +143,27 @@ namespace Check.Main.Infer | ||||
|             set { if (_path != value) { _path = value; OnPropertyChanged(); } } | ||||
|         } | ||||
|  | ||||
|         [Category("模型参数"), DisplayName("HALCON得分阈值"), Description("HALCON模板匹配的得分阈值(0-1)。")] | ||||
|         public double HalconScoreThreshold | ||||
|         { | ||||
|             get => _halconScoreThreshold; | ||||
|             set { if (_halconScoreThreshold != value) { _halconScoreThreshold = value; OnPropertyChanged(); } } | ||||
|         } | ||||
|  | ||||
|         [Category("模型参数"), DisplayName("YOLO置信度阈值"), Description("YOLO检测的置信度阈值(0-1)。")] | ||||
|         public float YoloConfidenceThreshold | ||||
|         { | ||||
|             get => _yoloConfidenceThreshold; | ||||
|             set { if (_yoloConfidenceThreshold != value) { _yoloConfidenceThreshold = value; OnPropertyChanged(); } } | ||||
|         } | ||||
|  | ||||
|         [Category("模型参数"), DisplayName("YOLO NMS阈值"), Description("YOLO检测的非极大值抑制(NMS)阈值(0-1)。")] | ||||
|         public float YoloNmsThreshold | ||||
|         { | ||||
|             get => _yoloNmsThreshold; | ||||
|             set { if (_yoloNmsThreshold != value) { _yoloNmsThreshold = value; OnPropertyChanged(); } } | ||||
|         } | ||||
|  | ||||
|         protected void OnPropertyChanged([CallerMemberName] string propertyName = null) | ||||
|         { | ||||
|             PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user