Commit eb1109d2 LN

料盘验证时若未扫到条码,增加料盘识别

1 个父辈 58d1a0b3
...@@ -89,6 +89,7 @@ ...@@ -89,6 +89,7 @@
<Compile Include="assemblymanager\TrayManager.cs" /> <Compile Include="assemblymanager\TrayManager.cs" />
<Compile Include="baan\AxisBean.cs" /> <Compile Include="baan\AxisBean.cs" />
<Compile Include="baan\WaitUtil.cs" /> <Compile Include="baan\WaitUtil.cs" />
<Compile Include="deviceLibrary\halcon\EyemManager.cs" />
<Compile Include="deviceLibrary\reelCheck\MyCamera.cs" /> <Compile Include="deviceLibrary\reelCheck\MyCamera.cs" />
<Compile Include="deviceLibrary\reelCheck\ReelCheckUtil.cs" /> <Compile Include="deviceLibrary\reelCheck\ReelCheckUtil.cs" />
<Compile Include="deviceLibrary\halcon\CodeManager.cs" /> <Compile Include="deviceLibrary\halcon\CodeManager.cs" />
...@@ -249,6 +250,12 @@ ...@@ -249,6 +250,12 @@
<Content Include="Config\Camera.json"> <Content Include="Config\Camera.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<None Include="darknet\detect-tiny-label.cfg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="darknet\detect-tiny-label.weights">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="LineConfig\Config_FeedingEquip_1.csv"> <None Include="LineConfig\Config_FeedingEquip_1.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
......
...@@ -169,26 +169,16 @@ namespace OnlineStore.DeviceLibrary ...@@ -169,26 +169,16 @@ namespace OnlineStore.DeviceLibrary
{ {
//扫码 //扫码
(bool result, string barcode) = CodeManager.ReelCheckCameraScan(new List<string> { Config.CameraName_1 }, Name); (bool result, string barcode) = CodeManager.ReelCheckCameraScan(new List<string> { Config.CameraName_1 }, Name);
//没扫到条码,检测到没料 ,保存图片, 清空
if (tray.IsFull)//初次检测有料盘 if (tray.IsFull)//初次检测有料盘
{ {
if (result)//有料盘 if (result)//有料盘
{ {
(int resCode, taskInfo task) = SServerManager.getTaskInfo(barcode); (int resCode, taskInfo task) = SServerManager.getTaskInfo(barcode);
if (resCode == -1) if (resCode == 0)
{
TrayDisableManager.AddDisableTray(trayNum);
LogUtil.info($"【屏蔽料盘二次判断】【-1】【需要禁用该托盘】【{tray.ToStr()}】");
}
else if (resCode == 100)
{
tray.InoutPar.InStoreNg = true;
tray.InoutPar.PlateH = task.plateH;
tray.InoutPar.PlateW = task.plateW;
TrayManager.UpdateTrayInfo(trayNum, true, tray.InOrOutStore, tray.InoutPar);
tray.InoutPar.Corrected = true;
LogUtil.info($"【屏蔽料盘二次判断】【100】【有尺寸信息,认为NG】【{tray.ToStr()}】");
}
else if (resCode == 0)
{ {
//if (task != null) //if (task != null)
{ {
...@@ -213,6 +203,21 @@ namespace OnlineStore.DeviceLibrary ...@@ -213,6 +203,21 @@ namespace OnlineStore.DeviceLibrary
LogUtil.info($"【屏蔽料盘二次判断】【初次有料,第二次有料,认为有料】【{tray.ToStr()}】"); LogUtil.info($"【屏蔽料盘二次判断】【初次有料,第二次有料,认为有料】【{tray.ToStr()}】");
} }
} }
else if (task.plateH > 0)
{
tray.InoutPar.InStoreNg = true;
tray.InoutPar.PlateH = task.plateH;
tray.InoutPar.PlateW = task.plateW;
TrayManager.UpdateTrayInfo(trayNum, true, tray.InOrOutStore, tray.InoutPar);
tray.InoutPar.Corrected = true;
LogUtil.info($"【屏蔽料盘二次判断】【100】【有尺寸信息,认为NG】【{tray.ToStr()}】");
}
else
{
TrayDisableManager.AddDisableTray(trayNum);
LogUtil.info($"【屏蔽料盘二次判断】【-1】【需要禁用该托盘】【{tray.ToStr()}】");
}
} }
else//二次检测无料盘 else//二次检测无料盘
......
[net]
# Testing
batch=1
subdivisions=1
# Training
# batch=64
# subdivisions=64
width=960
height=960
channels=3
momentum=0.9
decay=0.0005
angle=180
saturation = 1.5
exposure = 1.5
hue=.1
learning_rate=0.001
burn_in=1000
max_batches = 4000
policy=steps
steps=3200,3600
scales=.1,.1
[convolutional]
batch_normalize=1
filters=16
size=3
stride=1
pad=1
activation=leaky
[maxpool]
size=2
stride=2
[convolutional]
batch_normalize=1
filters=32
size=3
stride=1
pad=1
activation=leaky
[maxpool]
size=2
stride=2
[convolutional]
batch_normalize=1
filters=64
size=3
stride=1
pad=1
activation=leaky
[maxpool]
size=2
stride=2
[convolutional]
batch_normalize=1
filters=128
size=3
stride=1
pad=1
activation=leaky
[maxpool]
size=2
stride=2
[convolutional]
batch_normalize=1
filters=256
size=3
stride=1
pad=1
activation=leaky
[maxpool]
size=2
stride=2
[convolutional]
batch_normalize=1
filters=512
size=3
stride=1
pad=1
activation=leaky
[maxpool]
size=2
stride=1
[convolutional]
batch_normalize=1
filters=1024
size=3
stride=1
pad=1
activation=leaky
###########
[convolutional]
batch_normalize=1
filters=256
size=1
stride=1
pad=1
activation=leaky
[convolutional]
batch_normalize=1
filters=512
size=3
stride=1
pad=1
activation=leaky
[convolutional]
size=1
stride=1
pad=1
filters=18
activation=linear
[yolo]
mask = 3,4,5
anchors = 10,14, 23,27, 37,58, 81,82, 135,169, 344,319
classes=1
num=6
jitter=.3
ignore_thresh = .7
truth_thresh = 1
random=1
[route]
layers = -4
[convolutional]
batch_normalize=1
filters=128
size=1
stride=1
pad=1
activation=leaky
[upsample]
stride=2
[route]
layers = -1, 8
[convolutional]
batch_normalize=1
filters=256
size=3
stride=1
pad=1
activation=leaky
[convolutional]
size=1
stride=1
pad=1
filters=18
activation=linear
[yolo]
mask = 0,1,2
anchors = 10,14, 23,27, 37,58, 81,82, 135,169, 344,319
classes=1
num=6
jitter=.3
ignore_thresh = .7
truth_thresh = 1
random=1
...@@ -46,6 +46,8 @@ namespace OnlineStore.DeviceLibrary ...@@ -46,6 +46,8 @@ namespace OnlineStore.DeviceLibrary
LoadCamera(false); LoadCamera(false);
CodeLibrary.HDCodeLearnHelper.LoadConfig("", codeStr); CodeLibrary.HDCodeLearnHelper.LoadConfig("", codeStr);
CodeLibrary.EyemDecode.InitModel(); CodeLibrary.EyemDecode.InitModel();
EyemManager.Init();
} }
catch (Exception ex) catch (Exception ex)
{ {
...@@ -259,11 +261,11 @@ namespace OnlineStore.DeviceLibrary ...@@ -259,11 +261,11 @@ namespace OnlineStore.DeviceLibrary
} }
[HandleProcessCorruptedStateExceptions] [HandleProcessCorruptedStateExceptions]
public static (bool,string) ReelCheckCameraScan(List<string> cameraList, string deviceName) public static (bool, string) ReelCheckCameraScan(List<string> cameraList, string deviceName)
{ {
bool isPreScan = deviceName.EndsWith("预扫码");
List<string> codeList = new List<string>(); List<string> codeList = new List<string>();
bool findCode = true; bool findCode = true;
string code = "";
if (cameraList == null || cameraList.Count <= 0) if (cameraList == null || cameraList.Count <= 0)
{ {
return (findCode, ProcessCode(codeList)); return (findCode, ProcessCode(codeList));
...@@ -298,8 +300,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -298,8 +300,9 @@ namespace OnlineStore.DeviceLibrary
string r = ""; string r = "";
// bool eyemNoCode = false; // bool eyemNoCode = false;
Task eyemtask = Task.Factory.StartNew(delegate { Task eyemtask = Task.Factory.StartNew(delegate
{
List<CodeInfo> tlci = EyemDecode.ModelDecoder(ref bmp); List<CodeInfo> tlci = EyemDecode.ModelDecoder(ref bmp);
foreach (CodeInfo co in tlci) foreach (CodeInfo co in tlci)
{ {
...@@ -309,14 +312,10 @@ namespace OnlineStore.DeviceLibrary ...@@ -309,14 +312,10 @@ namespace OnlineStore.DeviceLibrary
{ {
codeList.Add(str); codeList.Add(str);
r = r + "##eyem|" + co.CodeType + "|" + str; r = r + "##eyem|" + co.CodeType + "|" + str;
//if (!findCode)
//{
// findCode = HasRightCode(str);
//}
} }
} }
}); });
//最多等待60秒 //最多等待60秒
bool taskResult = eyemtask.Wait(60000); bool taskResult = eyemtask.Wait(60000);
if (!taskResult) if (!taskResult)
...@@ -325,59 +324,59 @@ namespace OnlineStore.DeviceLibrary ...@@ -325,59 +324,59 @@ namespace OnlineStore.DeviceLibrary
//eyemNoCode = true; //eyemNoCode = true;
} }
//if (!isPreScan) code = ProcessCode(codeList);
//{ findCode = string.IsNullOrEmpty(code) ? false : true;
// if (!findCode)
// { if (!findCode)
// try {
// { try
// List<CodeInfo> cc = new List<CodeInfo>(); {
// eyemNoCode = true; List<CodeInfo> cc = new List<CodeInfo>();
// RemoteDecodeHelper.RemoteDecodeParam remoteDecodeParam = new RemoteDecodeHelper.RemoteDecodeParam RemoteDecodeHelper.RemoteDecodeParam remoteDecodeParam = new RemoteDecodeHelper.RemoteDecodeParam
// { {
// codeTypeList = allCodeTypeList.ToArray(), codeTypeList = allCodeTypeList.ToArray(),
// codeCount = 3, codeCount = 3,
// timeout = 3000 timeout = 3000
// }; };
// cc = RemoteDecodeHelper.DecodeRequest(ho_Image, remoteDecodeParam); cc = RemoteDecodeHelper.DecodeRequest(ho_Image, remoteDecodeParam);
// if (cc != null && cc.Count > 0) findCode = true; if (cc != null && cc.Count > 0) findCode = true;
// //if (cc != null) if (cc != null)
// //{ {
// // foreach (CodeInfo c in cc) foreach (CodeInfo c in cc)
// // { {
// // string str = CodeManager.ReplaceCode(c.CodeStr); string str = CodeManager.ReplaceCode(c.CodeStr);
// // if (!codeList.Contains(str)) if (!codeList.Contains(str))
// // { {
// // codeList.Add(str); codeList.Add(str);
// // r = r + "##halcon|" + c.CodeType + "|" + str; r = r + "##halcon|" + c.CodeType + "|" + str;
// // if (!findCode) }
// // { }
// // findCode = HasRightCode(str); }
// // } }
// // } catch (Exception ex)
// // } {
// //} LogUtil.error(deviceName + " RemoteDecodeHelper扫码出错:" + ex.ToString());
}
// } code = ProcessCode(codeList);
// catch (Exception ex) findCode = string.IsNullOrEmpty(code) ? false : true;
// { }
// LogUtil.error(deviceName + " RemoteDecodeHelper扫码出错:" + ex.ToString());
// }
// } if (!findCode)
// //if (!findRightCode && SaveErrorImageToFile.Equals(1)) {
// if (SaveImage || (((!findCode) || eyemNoCode) && (!isPreScan))) //验证是否有料盘
// { findCode = EyemManager.ReelCheck(bmp);
// //如果halcon没扫出的, }
// string nameStr = "";
// if (findCode && eyemNoCode) if (!findCode)
// { {
// nameStr = "eyem"; string nameStr = "nofindCode";
// } SaveImageToFile(deviceName, cameraName + nameStr, bmp);
}
// SaveImageToFile(deviceName, cameraName + nameStr, bmp);
// }
//}
if (deviceName != "" || r != "") if (deviceName != "" || r != "")
{ {
LogUtil.info(deviceName + " 【" + cameraName + "】扫码完成【" + FormUtil.GetSpanStr(DateTime.Now - startTime) + "】[" + findCode + "]" + ScanCount + " :" + r); LogUtil.info(deviceName + " 【" + cameraName + "】扫码完成【" + FormUtil.GetSpanStr(DateTime.Now - startTime) + "】[" + findCode + "]" + ScanCount + " :" + r);
...@@ -416,9 +415,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -416,9 +415,7 @@ namespace OnlineStore.DeviceLibrary
{ {
LogUtil.error(deviceName + " 扫码出错:" + ex.ToString()); LogUtil.error(deviceName + " 扫码出错:" + ex.ToString());
} }
string code = ProcessCode(codeList); return (findCode, code);
findCode = string.IsNullOrEmpty(code) ? false : true;
return (findCode,code);
} }
private static int SaveErrorImageToFile = ConfigAppSettings.GetIntValue(Setting_Init.SaveErrorImageToFile); private static int SaveErrorImageToFile = ConfigAppSettings.GetIntValue(Setting_Init.SaveErrorImageToFile);
......
...@@ -61,7 +61,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -61,7 +61,7 @@ namespace OnlineStore.DeviceLibrary
/// </summary> /// </summary>
public bool InStoreNg = false; public bool InStoreNg = false;
/// <summary> /// <summary>
/// 手动判断NG /// 手动判断NG 不处理
/// </summary> /// </summary>
public bool ManualJudgeNG = false; public bool ManualJudgeNG = false;
/// <summary> /// <summary>
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!