Commit 7e3fdb21 LN

扫码新算法更新

1 个父辈 9738d6f8
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
[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
此文件太大,无法显示。
此文件类型无法预览
layer {
name: "data"
type: "Input"
top: "data"
input_param {
shape {
dim: 1
dim: 1
dim: 224
dim: 224
}
}
}
layer {
name: "conv0"
type: "Convolution"
bottom: "data"
top: "conv0"
param {
lr_mult: 1.0
decay_mult: 1.0
}
param {
lr_mult: 1.0
decay_mult: 0.0
}
convolution_param {
num_output: 32
bias_term: true
pad: 1
kernel_size: 3
group: 1
stride: 1
weight_filler {
type: "msra"
}
}
}
layer {
name: "conv0/lrelu"
type: "ReLU"
bottom: "conv0"
top: "conv0"
relu_param {
negative_slope: 0.05000000074505806
}
}
layer {
name: "db1/reduce"
type: "Convolution"
bottom: "conv0"
top: "db1/reduce"
param {
lr_mult: 1.0
decay_mult: 1.0
}
param {
lr_mult: 1.0
decay_mult: 0.0
}
convolution_param {
num_output: 8
bias_term: true
pad: 0
kernel_size: 1
group: 1
stride: 1
weight_filler {
type: "msra"
}
}
}
layer {
name: "db1/reduce/lrelu"
type: "ReLU"
bottom: "db1/reduce"
top: "db1/reduce"
relu_param {
negative_slope: 0.05000000074505806
}
}
layer {
name: "db1/3x3"
type: "Convolution"
bottom: "db1/reduce"
top: "db1/3x3"
param {
lr_mult: 1.0
decay_mult: 1.0
}
param {
lr_mult: 1.0
decay_mult: 0.0
}
convolution_param {
num_output: 8
bias_term: true
pad: 1
kernel_size: 3
group: 8
stride: 1
weight_filler {
type: "msra"
}
}
}
layer {
name: "db1/3x3/lrelu"
type: "ReLU"
bottom: "db1/3x3"
top: "db1/3x3"
relu_param {
negative_slope: 0.05000000074505806
}
}
layer {
name: "db1/1x1"
type: "Convolution"
bottom: "db1/3x3"
top: "db1/1x1"
param {
lr_mult: 1.0
decay_mult: 1.0
}
param {
lr_mult: 1.0
decay_mult: 0.0
}
convolution_param {
num_output: 32
bias_term: true
pad: 0
kernel_size: 1
group: 1
stride: 1
weight_filler {
type: "msra"
}
}
}
layer {
name: "db1/1x1/lrelu"
type: "ReLU"
bottom: "db1/1x1"
top: "db1/1x1"
relu_param {
negative_slope: 0.05000000074505806
}
}
layer {
name: "db1/concat"
type: "Concat"
bottom: "conv0"
bottom: "db1/1x1"
top: "db1/concat"
concat_param {
axis: 1
}
}
layer {
name: "db2/reduce"
type: "Convolution"
bottom: "db1/concat"
top: "db2/reduce"
param {
lr_mult: 1.0
decay_mult: 1.0
}
param {
lr_mult: 1.0
decay_mult: 0.0
}
convolution_param {
num_output: 8
bias_term: true
pad: 0
kernel_size: 1
group: 1
stride: 1
weight_filler {
type: "msra"
}
}
}
layer {
name: "db2/reduce/lrelu"
type: "ReLU"
bottom: "db2/reduce"
top: "db2/reduce"
relu_param {
negative_slope: 0.05000000074505806
}
}
layer {
name: "db2/3x3"
type: "Convolution"
bottom: "db2/reduce"
top: "db2/3x3"
param {
lr_mult: 1.0
decay_mult: 1.0
}
param {
lr_mult: 1.0
decay_mult: 0.0
}
convolution_param {
num_output: 8
bias_term: true
pad: 1
kernel_size: 3
group: 8
stride: 1
weight_filler {
type: "msra"
}
}
}
layer {
name: "db2/3x3/lrelu"
type: "ReLU"
bottom: "db2/3x3"
top: "db2/3x3"
relu_param {
negative_slope: 0.05000000074505806
}
}
layer {
name: "db2/1x1"
type: "Convolution"
bottom: "db2/3x3"
top: "db2/1x1"
param {
lr_mult: 1.0
decay_mult: 1.0
}
param {
lr_mult: 1.0
decay_mult: 0.0
}
convolution_param {
num_output: 32
bias_term: true
pad: 0
kernel_size: 1
group: 1
stride: 1
weight_filler {
type: "msra"
}
}
}
layer {
name: "db2/1x1/lrelu"
type: "ReLU"
bottom: "db2/1x1"
top: "db2/1x1"
relu_param {
negative_slope: 0.05000000074505806
}
}
layer {
name: "db2/concat"
type: "Concat"
bottom: "db1/concat"
bottom: "db2/1x1"
top: "db2/concat"
concat_param {
axis: 1
}
}
layer {
name: "upsample/reduce"
type: "Convolution"
bottom: "db2/concat"
top: "upsample/reduce"
param {
lr_mult: 1.0
decay_mult: 1.0
}
param {
lr_mult: 1.0
decay_mult: 0.0
}
convolution_param {
num_output: 32
bias_term: true
pad: 0
kernel_size: 1
group: 1
stride: 1
weight_filler {
type: "msra"
}
}
}
layer {
name: "upsample/reduce/lrelu"
type: "ReLU"
bottom: "upsample/reduce"
top: "upsample/reduce"
relu_param {
negative_slope: 0.05000000074505806
}
}
layer {
name: "upsample/deconv"
type: "Deconvolution"
bottom: "upsample/reduce"
top: "upsample/deconv"
param {
lr_mult: 1.0
decay_mult: 1.0
}
param {
lr_mult: 1.0
decay_mult: 0.0
}
convolution_param {
num_output: 32
bias_term: true
pad: 1
kernel_size: 3
group: 32
stride: 2
weight_filler {
type: "msra"
}
}
}
layer {
name: "upsample/lrelu"
type: "ReLU"
bottom: "upsample/deconv"
top: "upsample/deconv"
relu_param {
negative_slope: 0.05000000074505806
}
}
layer {
name: "upsample/rec"
type: "Convolution"
bottom: "upsample/deconv"
top: "upsample/rec"
param {
lr_mult: 1.0
decay_mult: 1.0
}
param {
lr_mult: 1.0
decay_mult: 0.0
}
convolution_param {
num_output: 1
bias_term: true
pad: 0
kernel_size: 1
group: 1
stride: 1
weight_filler {
type: "msra"
}
}
}
layer {
name: "nearest"
type: "Deconvolution"
bottom: "data"
top: "nearest"
param {
lr_mult: 0.0
decay_mult: 0.0
}
convolution_param {
num_output: 1
bias_term: false
pad: 0
kernel_size: 2
group: 1
stride: 2
weight_filler {
type: "constant"
value: 1.0
}
}
}
layer {
name: "Crop1"
type: "Crop"
bottom: "nearest"
bottom: "upsample/rec"
top: "Crop1"
}
layer {
name: "fc"
type: "Eltwise"
bottom: "Crop1"
bottom: "upsample/rec"
top: "fc"
eltwise_param {
operation: SUM
}
}
此文件类型无法预览
......@@ -234,6 +234,18 @@
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<Content Include="model\detect-tiny.cfg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="model\detect-tiny.weights">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="model\sr.caffemodel">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="model\sr.prototxt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
......
......@@ -312,13 +312,14 @@ namespace OnlineStore.AssemblyLine
}
// CodeManager.CloseAllCamera();
// RFIDManager.Close();
System.Environment.Exit(System.Environment.ExitCode);
//System.Environment.Exit(System.Environment.ExitCode);
System.Diagnostics.Process.GetCurrentProcess().Kill();
}
catch (Exception ex)
{
LogUtil.error("退出出错:", ex);
}
//this.Close();
this.Close();
}
}
private void 显示ToolStripMenuItem_Click(object sender, EventArgs e)
......
[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
layer {
name: "data"
type: "Input"
top: "data"
input_param {
shape {
dim: 1
dim: 1
dim: 224
dim: 224
}
}
}
layer {
name: "conv0"
type: "Convolution"
bottom: "data"
top: "conv0"
param {
lr_mult: 1.0
decay_mult: 1.0
}
param {
lr_mult: 1.0
decay_mult: 0.0
}
convolution_param {
num_output: 32
bias_term: true
pad: 1
kernel_size: 3
group: 1
stride: 1
weight_filler {
type: "msra"
}
}
}
layer {
name: "conv0/lrelu"
type: "ReLU"
bottom: "conv0"
top: "conv0"
relu_param {
negative_slope: 0.05000000074505806
}
}
layer {
name: "db1/reduce"
type: "Convolution"
bottom: "conv0"
top: "db1/reduce"
param {
lr_mult: 1.0
decay_mult: 1.0
}
param {
lr_mult: 1.0
decay_mult: 0.0
}
convolution_param {
num_output: 8
bias_term: true
pad: 0
kernel_size: 1
group: 1
stride: 1
weight_filler {
type: "msra"
}
}
}
layer {
name: "db1/reduce/lrelu"
type: "ReLU"
bottom: "db1/reduce"
top: "db1/reduce"
relu_param {
negative_slope: 0.05000000074505806
}
}
layer {
name: "db1/3x3"
type: "Convolution"
bottom: "db1/reduce"
top: "db1/3x3"
param {
lr_mult: 1.0
decay_mult: 1.0
}
param {
lr_mult: 1.0
decay_mult: 0.0
}
convolution_param {
num_output: 8
bias_term: true
pad: 1
kernel_size: 3
group: 8
stride: 1
weight_filler {
type: "msra"
}
}
}
layer {
name: "db1/3x3/lrelu"
type: "ReLU"
bottom: "db1/3x3"
top: "db1/3x3"
relu_param {
negative_slope: 0.05000000074505806
}
}
layer {
name: "db1/1x1"
type: "Convolution"
bottom: "db1/3x3"
top: "db1/1x1"
param {
lr_mult: 1.0
decay_mult: 1.0
}
param {
lr_mult: 1.0
decay_mult: 0.0
}
convolution_param {
num_output: 32
bias_term: true
pad: 0
kernel_size: 1
group: 1
stride: 1
weight_filler {
type: "msra"
}
}
}
layer {
name: "db1/1x1/lrelu"
type: "ReLU"
bottom: "db1/1x1"
top: "db1/1x1"
relu_param {
negative_slope: 0.05000000074505806
}
}
layer {
name: "db1/concat"
type: "Concat"
bottom: "conv0"
bottom: "db1/1x1"
top: "db1/concat"
concat_param {
axis: 1
}
}
layer {
name: "db2/reduce"
type: "Convolution"
bottom: "db1/concat"
top: "db2/reduce"
param {
lr_mult: 1.0
decay_mult: 1.0
}
param {
lr_mult: 1.0
decay_mult: 0.0
}
convolution_param {
num_output: 8
bias_term: true
pad: 0
kernel_size: 1
group: 1
stride: 1
weight_filler {
type: "msra"
}
}
}
layer {
name: "db2/reduce/lrelu"
type: "ReLU"
bottom: "db2/reduce"
top: "db2/reduce"
relu_param {
negative_slope: 0.05000000074505806
}
}
layer {
name: "db2/3x3"
type: "Convolution"
bottom: "db2/reduce"
top: "db2/3x3"
param {
lr_mult: 1.0
decay_mult: 1.0
}
param {
lr_mult: 1.0
decay_mult: 0.0
}
convolution_param {
num_output: 8
bias_term: true
pad: 1
kernel_size: 3
group: 8
stride: 1
weight_filler {
type: "msra"
}
}
}
layer {
name: "db2/3x3/lrelu"
type: "ReLU"
bottom: "db2/3x3"
top: "db2/3x3"
relu_param {
negative_slope: 0.05000000074505806
}
}
layer {
name: "db2/1x1"
type: "Convolution"
bottom: "db2/3x3"
top: "db2/1x1"
param {
lr_mult: 1.0
decay_mult: 1.0
}
param {
lr_mult: 1.0
decay_mult: 0.0
}
convolution_param {
num_output: 32
bias_term: true
pad: 0
kernel_size: 1
group: 1
stride: 1
weight_filler {
type: "msra"
}
}
}
layer {
name: "db2/1x1/lrelu"
type: "ReLU"
bottom: "db2/1x1"
top: "db2/1x1"
relu_param {
negative_slope: 0.05000000074505806
}
}
layer {
name: "db2/concat"
type: "Concat"
bottom: "db1/concat"
bottom: "db2/1x1"
top: "db2/concat"
concat_param {
axis: 1
}
}
layer {
name: "upsample/reduce"
type: "Convolution"
bottom: "db2/concat"
top: "upsample/reduce"
param {
lr_mult: 1.0
decay_mult: 1.0
}
param {
lr_mult: 1.0
decay_mult: 0.0
}
convolution_param {
num_output: 32
bias_term: true
pad: 0
kernel_size: 1
group: 1
stride: 1
weight_filler {
type: "msra"
}
}
}
layer {
name: "upsample/reduce/lrelu"
type: "ReLU"
bottom: "upsample/reduce"
top: "upsample/reduce"
relu_param {
negative_slope: 0.05000000074505806
}
}
layer {
name: "upsample/deconv"
type: "Deconvolution"
bottom: "upsample/reduce"
top: "upsample/deconv"
param {
lr_mult: 1.0
decay_mult: 1.0
}
param {
lr_mult: 1.0
decay_mult: 0.0
}
convolution_param {
num_output: 32
bias_term: true
pad: 1
kernel_size: 3
group: 32
stride: 2
weight_filler {
type: "msra"
}
}
}
layer {
name: "upsample/lrelu"
type: "ReLU"
bottom: "upsample/deconv"
top: "upsample/deconv"
relu_param {
negative_slope: 0.05000000074505806
}
}
layer {
name: "upsample/rec"
type: "Convolution"
bottom: "upsample/deconv"
top: "upsample/rec"
param {
lr_mult: 1.0
decay_mult: 1.0
}
param {
lr_mult: 1.0
decay_mult: 0.0
}
convolution_param {
num_output: 1
bias_term: true
pad: 0
kernel_size: 1
group: 1
stride: 1
weight_filler {
type: "msra"
}
}
}
layer {
name: "nearest"
type: "Deconvolution"
bottom: "data"
top: "nearest"
param {
lr_mult: 0.0
decay_mult: 0.0
}
convolution_param {
num_output: 1
bias_term: false
pad: 0
kernel_size: 2
group: 1
stride: 2
weight_filler {
type: "constant"
value: 1.0
}
}
}
layer {
name: "Crop1"
type: "Crop"
bottom: "nearest"
bottom: "upsample/rec"
top: "Crop1"
}
layer {
name: "fc"
type: "Eltwise"
bottom: "Crop1"
bottom: "upsample/rec"
top: "fc"
eltwise_param {
operation: SUM
}
}
......@@ -125,12 +125,18 @@
<Content Include="halcon.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="libdecode.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="libdmtx.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="opencv_world420.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="tbb.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="zxing.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
......
......@@ -1323,8 +1323,10 @@ namespace OnlineStore.DeviceLibrary
BatchAxis.AbsMove(MoveInfo, targetPosition, Config.BatchAxis_P4Speed);
}
private Task YuScanTask = null;
private void YuScanCode()
{
YuScanTask = null;
bool isScan = ConfigAppSettings.GetIntValue(Setting_Init.NeedScanCode).Equals(1);
//TODO 此处需要等待空托盘
if (MoveInfo.ShelfNoTray.Equals(false) && isScan)
......@@ -1335,7 +1337,7 @@ namespace OnlineStore.DeviceLibrary
List<string> bijiaoList = new List<string>(LastCodeList);
try
{
Task<List<string>> scanTask = Task.Factory.StartNew(delegate
YuScanTask = Task.Factory.StartNew(delegate
{
Thread.Sleep(100);
NextCodeList = CodeManager.CameraScan(Config.GetCameraList(), Name.Trim()+"预扫码");
......@@ -1391,53 +1393,63 @@ namespace OnlineStore.DeviceLibrary
{
if (CylinderIsOk(IO_Type.SL_MoveCylinder_Take, IO_Type.SL_MoveCylinder_Give))
{
MoveInfo.NextMoveStep(LineMoveStep.FI_13_ScanCode);
bool isScan = ConfigAppSettings.GetIntValue(Setting_Init.NeedScanCode).Equals(1);
if (YuScanTask == null || YuScanTask.IsCompleted)
{
ClearTimeoutAlarm("预扫码结束超时");
MoveInfo.NextMoveStep(LineMoveStep.FI_13_ScanCode);
bool isScan = ConfigAppSettings.GetIntValue(Setting_Init.NeedScanCode).Equals(1);
LastCodeList = new List<string>();
LastCodeList = new List<string>();
ScanCodeTask = null;
if (NextCodeList.Count > 0)
{
InLog("料盘移栽" + MoveInfo.SLog + ":开始扫码:使用预扫码");
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(300));
LastCodeList = new List<string>(NextCodeList);
NextCodeList = new List<string>();
MoveInfo.NextMoveStep(LineMoveStep.FI_14_CylinderTake);
InLog("料盘移栽" + MoveInfo.SLog + ":上料横移取料端");
CylinderMove(MoveInfo, IO_Type.SL_MoveCylinder_Give, IO_Type.SL_MoveCylinder_Take);
}
else if (isScan)
{
InLog("料盘移栽" + MoveInfo.SLog + ":开始扫码");
MoveInfo.OneWaitCanEndStep = true;
MoveInfo.WaitList.Add(WaitResultInfo.WaitFeedScanCode());
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(7000));
try
ScanCodeTask = null;
if (NextCodeList.Count > 0)
{
InLog("料盘移栽" + MoveInfo.SLog + ":开始扫码:使用预扫码");
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(300));
LastCodeList = new List<string>(NextCodeList);
NextCodeList = new List<string>();
MoveInfo.NextMoveStep(LineMoveStep.FI_14_CylinderTake);
InLog("料盘移栽" + MoveInfo.SLog + ":上料横移取料端");
CylinderMove(MoveInfo, IO_Type.SL_MoveCylinder_Give, IO_Type.SL_MoveCylinder_Take);
}
else if (isScan)
{
ScanCodeTask = Task.Factory.StartNew(delegate
InLog("料盘移栽" + MoveInfo.SLog + ":开始扫码");
MoveInfo.OneWaitCanEndStep = true;
MoveInfo.WaitList.Add(WaitResultInfo.WaitFeedScanCode());
MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(7000));
try
{
LastCodeList = CodeManager.CameraScan(Config.GetCameraList(), Name);
bool hasRightCode = CodeManager.HasRightCode(LastCodeList.ToArray());
if (!hasRightCode)
ScanCodeTask = Task.Factory.StartNew(delegate
{
LastCodeList = CodeManager.CameraScan(Config.GetCameraList(), Name, false, 3000);
}
return LastCodeList;
});
LastCodeList = CodeManager.CameraScan(Config.GetCameraList(), Name);
bool hasRightCode = CodeManager.HasRightCode(LastCodeList.ToArray());
if (!hasRightCode)
{
LastCodeList = CodeManager.CameraScan(Config.GetCameraList(), Name, false, 3000);
}
return LastCodeList;
});
}
catch (Exception ex)
{
LogUtil.error("FI_13_ScanCode扫码出错:", ex);
}
//finally
//{
// MoveInfo.EndStepWait();
//}
}
catch (Exception ex)
else
{
LogUtil.error("FI_13_ScanCode扫码出错:", ex);
}
//finally
//{
// MoveInfo.EndStepWait();
//}
InLog("料盘移栽" + MoveInfo.SLog + ":不需要扫码");
}
}
else
else if (MoveInfo.IsTimeOut(60))
{
InLog("料盘移栽" + MoveInfo.SLog + ":不需要扫码");
WarnMsg = SecondMoveInfo.Name + "[" + SecondMoveInfo.MoveStep + "] 等待预扫码结束超时 [" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒";
LogUtil.error(WarnMsg, DeviceID * 1000 + 21);
Alarm(LineAlarmType.IoSingleTimeOut);
}
}
else
......
......@@ -45,6 +45,7 @@ namespace OnlineStore.DeviceLibrary
LoadCamera(false);
CodeLibrary.HDCodeLearnHelper.LoadConfig("", codeStr);
CodeLibrary.EyemDecode.InitModel();
}
catch (Exception ex)
{
......@@ -61,13 +62,13 @@ namespace OnlineStore.DeviceLibrary
{
Camera._cam.CloseAll();
}
Camera.Type = CameraType.HIK;
Camera.Type = CameraType.HIK;
Camera._cam.Load();
}
catch (Exception ex)
{
LogUtil.error("加载HIK相机出错:", ex);
}
}
}
string[] names = Camera._cam.Name;
......@@ -86,7 +87,7 @@ namespace OnlineStore.DeviceLibrary
{
LogUtil.info("加载到HIK相机:" + name);
}
}
}
}
public static void CloseCamera(string cameraName)
......@@ -94,9 +95,9 @@ namespace OnlineStore.DeviceLibrary
Camera._cam.Close(cameraName);
}
public static void CloseAllCamera()
{
{
Camera._cam.CloseAll();
}
}
private static int ScanCount = 0;
private static int codeCount = ConfigAppSettings.GetIntValue(Setting_Init.CodeCount);
[HandleProcessCorruptedStateExceptions]
......@@ -138,69 +139,81 @@ namespace OnlineStore.DeviceLibrary
LogUtil.debug(deviceName + " 【" + cameraName + "】取图片完成,开始扫码");
string r = "";
List<CodeInfo> tlci = EyemDecode.Decoder(ref bmp);
bool eyemNoCode = false;
foreach (CodeInfo code in tlci)
{
LogUtil.info(deviceName + " 【" + cameraName + "】[eyemDecode]" + code.CodeType + "(X: " + code.X + ",Y: " + code.Y + ") " + code.CodeStr);
string str = CodeManager.ReplaceCode(code.CodeStr);
if (!codeList.Contains(str))
Task eyemtask = Task.Factory.StartNew(delegate {
List<CodeInfo> tlci = EyemDecode.ModelDecoder(ref bmp);
foreach (CodeInfo code in tlci)
{
codeList.Add(str);
r = r + "##eyem|" + code.CodeType + "|" + str;
if (!findRightCode)
LogUtil.info(deviceName + " 【" + cameraName + "】[eyemDecode]" + code.CodeType + "(X: " + code.X + ",Y: " + code.Y + ") " + code.CodeStr);
string str = CodeManager.ReplaceCode(code.CodeStr);
if (!codeList.Contains(str))
{
findRightCode = HasRightCode(str);
codeList.Add(str);
r = r + "##eyem|" + code.CodeType + "|" + str;
if (!findRightCode)
{
findRightCode = HasRightCode(str);
}
}
}
}
if (!findRightCode &&(!isPreScan))
});
//最多等待60秒
bool taskResult = eyemtask.Wait(60000);
if (!taskResult)
{
List<CodeInfo> cc = new List<CodeInfo>();
LogUtil.error(deviceName + " 【" + cameraName + "】eyem扫码超时");
eyemNoCode = true;
foreach (string codeType in codeTypeList)
}
if (!isPreScan)
{
if (!findRightCode)
{
//判断是否是一维码
if (codeType.ToLower().Equals("barcode"))
{
cc = HDCodeHelper.DecodeBarCode(ho_Image);
}
else
{
cc = HDCodeHelper.DecodeCode(ho_Image, codeType, GetCodeParamFilePath(codeType), codeCount, timeOut);
}
foreach (CodeInfo c in cc)
List<CodeInfo> cc = new List<CodeInfo>();
eyemNoCode = true;
foreach (string codeType in codeTypeList)
{
string str = CodeManager.ReplaceCode(c.CodeStr);
if (!codeList.Contains(str))
//判断是否是一维码
if (codeType.ToLower().Equals("barcode"))
{
codeList.Add(str);
r = r + "##halcon|" + codeType + "|" + str;
if (!findRightCode)
cc = HDCodeHelper.DecodeBarCode(ho_Image);
}
else
{
cc = HDCodeHelper.DecodeCode(ho_Image, codeType, GetCodeParamFilePath(codeType), codeCount, timeOut);
}
foreach (CodeInfo c in cc)
{
string str = CodeManager.ReplaceCode(c.CodeStr);
if (!codeList.Contains(str))
{
findRightCode = HasRightCode(str);
codeList.Add(str);
r = r + "##halcon|" + codeType + "|" + str;
if (!findRightCode)
{
findRightCode = HasRightCode(str);
}
}
}
}
if (findRightCodeBreak && findRightCode)
{
break;
if (findRightCodeBreak && findRightCode)
{
break;
}
}
}
}
//if (!findRightCode && SaveErrorImageToFile.Equals(1))
if (SaveImage || (((!findRightCode) || eyemNoCode) && (!isPreScan)))
{
//如果halcon没扫出的,
string nameStr = "";
if (findRightCode && eyemNoCode)
//if (!findRightCode && SaveErrorImageToFile.Equals(1))
if (SaveImage || (((!findRightCode) || eyemNoCode) && (!isPreScan)))
{
nameStr = "eyem";
}
//如果halcon没扫出的,
string nameStr = "";
if (findRightCode && eyemNoCode)
{
nameStr = "eyem";
}
SaveImageToFile(deviceName, cameraName + nameStr, bmp);
SaveImageToFile(deviceName, cameraName + nameStr, bmp);
}
}
if (deviceName != "" || r != "")
{
......@@ -243,7 +256,7 @@ namespace OnlineStore.DeviceLibrary
return codeList;
}
private static int SaveErrorImageToFile = ConfigAppSettings.GetIntValue(Setting_Init.SaveErrorImageToFile);
private static int SaveErrorImageToFile = ConfigAppSettings.GetIntValue(Setting_Init.SaveErrorImageToFile);
private static void SaveImageToFile(string deviceName, string cameraName, HalconDotNet.HObject bitmap)
{
......@@ -267,7 +280,7 @@ namespace OnlineStore.DeviceLibrary
}
private static void SaveImageToFile(string deviceName, string cameraName, Bitmap bitmap)
{
string date = deviceName.Trim().Replace('_', '-') +"-"+ DateTime.Now.ToString("HH-mm-ss-") + DateTime.Now.Millisecond;
string date = deviceName.Trim().Replace('_', '-') +"-"+ DateTime.Now.ToString("yyyyMMdd-HHmmss") + DateTime.Now.Millisecond;
string dire = @"D:\image\" + deviceName.Trim().Replace('_', '-') + @"\" + cameraName.Trim().Replace('_', '-').Replace(':', '-') + @"\";
string iamgeName = date + ".bmp";
try
......
此文件类型无法预览
此文件类型无法预览
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!