This commit is contained in:
2025-03-21 08:51:20 +08:00
parent 0dedff36fd
commit 9a5d3be528
70 changed files with 4542 additions and 2207 deletions

View File

@ -1,5 +1,5 @@
using DH.Commons.Enums;
using DH.Devices.Devices;
using DH.Commons.Base;
using DH.Commons.Enums;
using DH.UI.Model.Winform;
using HalconDotNet;
using OpenCvSharp;
@ -15,7 +15,7 @@ using System.Windows.Forms;
using System.Xml.Linq;
using XKRS.UI.Model.Winform;
using static DH.Commons.Enums.EnumHelper;
using ResultState = DH.Commons.Enums.ResultState;
using ResultState = DH.Commons.Base.ResultState;
namespace DH.Devices.Vision
@ -113,7 +113,7 @@ namespace DH.Devices.Vision
// req.Score = IIConfig.Score;
req.mImage = originImgSet.Clone();
req.in_lable_path = detectConfig.in_lable_path;
req.in_lable_path = detectConfig.In_lable_path;
req.confThreshold = detectConfig.ModelconfThreshold;
req.iouThreshold = 0.3f;
@ -121,16 +121,16 @@ namespace DH.Devices.Vision
req.out_node_name = "output0";
switch (detectConfig.ModelType)
{
case MLModelType.ImageClassification:
case ModelType.:
break;
case MLModelType.ObjectDetection:
case ModelType.:
break;
case MLModelType.SemanticSegmentation:
case ModelType.:
break;
case MLModelType.InstanceSegmentation:
case ModelType.:
break;
case MLModelType.ObjectGPUDetection:
case ModelType.GPU:
break;
default:
@ -213,53 +213,53 @@ namespace DH.Devices.Vision
// .OrderBy(u => u.Key)
// .ToList();
//当前检测项的 过滤条件
var conditionList = detectConfig.DetectionFilterList
.Where(u => u.IsEnabled && u.LabelName == d.LabelName)
.GroupBy(u => u.ResultState)
.OrderBy(u => u.Key)
.ToList();
//var conditionList = detectConfig.DetectionFilterList
// .Where(u => u.IsEnabled && u.LabelName == d.LabelName)
// .GroupBy(u => u.ResultState)
// .OrderBy(u => u.Key)
// .ToList();
if (conditionList.Count == 0)
{
//if (conditionList.Count == 0)
//{
d.FinalResult = d.LabelName.ToLower() == "ok"
? ResultState.OK
: ResultState.DetectNG;
}
else
{
d.FinalResult = detectConfig.IsMixModel
? ResultState.A_NG
: ResultState.OK;
// d.FinalResult = d.LabelName.ToLower() == "ok"
// ? ResultState.OK
// : ResultState.DetectNG;
//}
//else
//{
// d.FinalResult = detectConfig.IsMixModel
// ? ResultState.A_NG
// : ResultState.OK;
}
//}
foreach (IGrouping<ResultState, DetectionFilter> group in conditionList)
{
//bool b = group.ToList().Any(f =>
//{
// return f.FilterOperation(d);
//});
//foreach (IGrouping<ResultState, DetectionFilter> group in conditionList)
//{
// //bool b = group.ToList().Any(f =>
// //{
// // return f.FilterOperation(d);
// //});
//if (b)
//{
// d.FinalResult = group.Key;
// break;
//}
// //if (b)
// //{
// // d.FinalResult = group.Key;
// // break;
// //}
if (group.Any(f => f.FilterOperation(d)))
{
d.FinalResult = group.Key;
break;
}
//else
//{
// d.FinalResult = d.InferenceResult = ResultState.OK;
//}
}
// if (group.Any(f => f.FilterOperation(d)))
// {
// d.FinalResult = group.Key;
// break;
// }
// //else
// //{
// // d.FinalResult = d.InferenceResult = ResultState.OK;
// //}
//}
});
#endregion
#region 5.NG
@ -395,18 +395,18 @@ namespace DH.Devices.Vision
// 根据算法类型创建不同的实例
switch (dc.ModelType)
{
case MLModelType.ImageClassification:
case ModelType.:
break;
case MLModelType.ObjectDetection:
case ModelType.:
mLEngineSet.StationMLEngine = new SimboObjectDetection();
break;
case MLModelType.SemanticSegmentation:
case ModelType.:
break;
case MLModelType.InstanceSegmentation:
case ModelType.:
mLEngineSet.StationMLEngine = new SimboInstanceSegmentation();
break;
case MLModelType.ObjectGPUDetection:
case ModelType.GPU:
mLEngineSet.StationMLEngine = new SimboDetection();
break;
default: