10.20PLC+相机2.3视觉修改
This commit is contained in:
		
							
								
								
									
										132
									
								
								Check.Main/Infer/ModelSettings.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										132
									
								
								Check.Main/Infer/ModelSettings.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,132 @@ | ||||
| using Check.Main.Common; | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.ComponentModel; | ||||
| using System.Linq; | ||||
| using System.Runtime.CompilerServices; | ||||
| using System.Runtime.Serialization; | ||||
| using System.Text; | ||||
| using System.Threading.Tasks; | ||||
|  | ||||
| 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("分类")] | ||||
|         Classification, | ||||
|  | ||||
|         [Description("检测")] | ||||
|         ObjectDetection, | ||||
|  | ||||
|         [Description("OBB")] | ||||
|         ObbDetection, | ||||
|  | ||||
|         [Description("分割")] | ||||
|         Segmentation, | ||||
|  | ||||
|         [Description("位姿")] | ||||
|         PoseEstimation | ||||
|     } | ||||
|  | ||||
|     [Serializable] // 确保可被XML序列化 | ||||
|     public class ModelSettings : INotifyPropertyChanged, ICloneable | ||||
|     { | ||||
|         public event PropertyChangedEventHandler PropertyChanged; | ||||
|  | ||||
|         private int _id; | ||||
|         private string _name = "New Model"; | ||||
|         private string _path = ""; | ||||
|         private DetectDevice _checkDevice=DetectDevice.CPU; | ||||
|         private AlgorithmType _mAType = AlgorithmType.Tradition; | ||||
|         private CheckModelType _mType = CheckModelType.Classification; | ||||
|         private bool _isEnabled = true; | ||||
|  | ||||
|         [Category("基本信息"), DisplayName("模型编号"), Description("模型的唯一标识符,用于与相机编号对应。")] | ||||
|         public int Id | ||||
|         { | ||||
|             get => _id; | ||||
|             set { if (_id != value) { _id = value; OnPropertyChanged(); } } | ||||
|         } | ||||
|  | ||||
|         [Category("基本信息"), DisplayName("模型名称"), Description("给模型起一个易于识别的别名。")] | ||||
|         public string Name | ||||
|         { | ||||
|             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))] | ||||
|         public AlgorithmType M_AType | ||||
|         { | ||||
|             get => _mAType; | ||||
|             set { if (_mAType != value) { _mAType = value; OnPropertyChanged(); } } | ||||
|         } | ||||
|         [Category("基本信息"), DisplayName("模型类型"), Description("推理模型的类型。")] | ||||
|         [TypeConverter(typeof(EnumDescriptionTypeConverter))] | ||||
|         public CheckModelType MType | ||||
|         { | ||||
|             get => _mType; | ||||
|             set { if (_mType != value) { _mType = value; OnPropertyChanged(); } } | ||||
|         } | ||||
|  | ||||
|         [Category("基本信息"), DisplayName("是否启用"), Description("是否在程序启动时是否启用模型")] | ||||
|         public bool IsEnabled | ||||
|         { | ||||
|             get => _isEnabled; | ||||
|             set | ||||
|             { | ||||
|                 if (_isEnabled != value) | ||||
|                 { | ||||
|                     _isEnabled = value; | ||||
|                     OnPropertyChanged(); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         [Category("文件"), DisplayName("模型路径"), Description("选择模型文件(.onnx, .bin, etc., .pt)。")] | ||||
|         [Editor(typeof(System.Windows.Forms.Design.FileNameEditor), typeof(System.Drawing.Design.UITypeEditor))] | ||||
|         public string Path | ||||
|         { | ||||
|             get => _path; | ||||
|             set { if (_path != value) { _path = value; OnPropertyChanged(); } } | ||||
|         } | ||||
|  | ||||
|         protected void OnPropertyChanged([CallerMemberName] string propertyName = null) | ||||
|         { | ||||
|             PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); | ||||
|         } | ||||
|  | ||||
|         public object Clone() | ||||
|         { | ||||
|             return this.MemberwiseClone(); // 浅克隆对于这个类足够了 | ||||
|         } | ||||
|  | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user