Commit 9663a05c LN

新算法更新

1 个父辈 2ef1b3ce
...@@ -312,9 +312,8 @@ ...@@ -312,9 +312,8 @@
this.btnScanTest.Name = "btnScanTest"; this.btnScanTest.Name = "btnScanTest";
this.btnScanTest.Size = new System.Drawing.Size(167, 33); this.btnScanTest.Size = new System.Drawing.Size(167, 33);
this.btnScanTest.TabIndex = 30; this.btnScanTest.TabIndex = 30;
this.btnScanTest.Text = "码测试"; this.btnScanTest.Text = "模型解码测试";
this.btnScanTest.UseVisualStyleBackColor = true; this.btnScanTest.UseVisualStyleBackColor = true;
this.btnScanTest.Visible = false;
this.btnScanTest.Click += new System.EventHandler(this.btnScanTest_Click); this.btnScanTest.Click += new System.EventHandler(this.btnScanTest_Click);
// //
// chbEyem // chbEyem
......
...@@ -180,7 +180,7 @@ namespace CodeLibrary ...@@ -180,7 +180,7 @@ namespace CodeLibrary
} }
private void ShowCode(List<CodeInfo> list) private void ShowCode(List<CodeInfo> list,Stopwatch stopwatch=null )
{ {
if (list.Count > 0) if (list.Count > 0)
{ {
...@@ -195,6 +195,10 @@ namespace CodeLibrary ...@@ -195,6 +195,10 @@ namespace CodeLibrary
{ {
txtResult.Text += "\r\n no code "; txtResult.Text += "\r\n no code ";
} }
if (stopwatch != null)
{
txtResult.Text += "\r\n elapsed time:" + stopwatch.Elapsed.ToString();
}
} }
private void btnbarCode_Click(object sender, EventArgs e) private void btnbarCode_Click(object sender, EventArgs e)
...@@ -222,8 +226,7 @@ namespace CodeLibrary ...@@ -222,8 +226,7 @@ namespace CodeLibrary
else else
{ {
List<CodeInfo> result = HDCodeHelper.DecodeBarCode(HDCodeLearnHelper.DefaultImage); List<CodeInfo> result = HDCodeHelper.DecodeBarCode(HDCodeLearnHelper.DefaultImage);
ShowCode(result); ShowCode(result,stopwatch);
txtResult.Text += "\r\n elapsed time:" + stopwatch.Elapsed.ToString();
} }
} }
public void ShowImage(HObject ho_Image) public void ShowImage(HObject ho_Image)
...@@ -256,7 +259,6 @@ namespace CodeLibrary ...@@ -256,7 +259,6 @@ namespace CodeLibrary
// Bitmap map = new Bitmap(pictureBox1.Image); // Bitmap map = new Bitmap(pictureBox1.Image);
//HObject ho_image = HDCodeHelper.Bitmap2HObjectBpp24(map); //HObject ho_image = HDCodeHelper.Bitmap2HObjectBpp24(map);
txtResult.Text += "\r\n elapsed time:" + stopwatch.Elapsed.ToString();
//hWindowControl1.HalconWindow.SetPart(0, 0, map.Height, map.Width); //hWindowControl1.HalconWindow.SetPart(0, 0, map.Height, map.Width);
//HOperatorSet.DispObj(ho_image, hWindowControl1.HalconWindow); //HOperatorSet.DispObj(ho_image, hWindowControl1.HalconWindow);
//ShowImage(ho_image); //ShowImage(ho_image);
...@@ -277,7 +279,7 @@ namespace CodeLibrary ...@@ -277,7 +279,7 @@ namespace CodeLibrary
{ {
Bitmap b = (Bitmap)HDCodeLearnHelper.DefaultBitmap.Clone(); Bitmap b = (Bitmap)HDCodeLearnHelper.DefaultBitmap.Clone();
List<CodeInfo> codeList = EyemDecode.Decoder(ref b); List<CodeInfo> codeList = EyemDecode.Decoder(ref b);
ShowCode(codeList); ShowCode(codeList,stopwatch);
return; return;
} }
} }
...@@ -296,9 +298,8 @@ namespace CodeLibrary ...@@ -296,9 +298,8 @@ namespace CodeLibrary
else else
{ {
codeList = HDCodeHelper.DecodeCode(HDCodeLearnHelper.DefaultImage, count, codeParamPath, cmbCodeType.Text); codeList = HDCodeHelper.DecodeCode(HDCodeLearnHelper.DefaultImage, count, codeParamPath, cmbCodeType.Text);
} }
ShowCode(codeList); ShowCode(codeList,stopwatch);
txtResult.Text += "\r\n elapsed time:" + stopwatch.Elapsed.ToString();
} }
...@@ -396,7 +397,11 @@ namespace CodeLibrary ...@@ -396,7 +397,11 @@ namespace CodeLibrary
private void btnExit_Click(object sender, EventArgs e) private void btnExit_Click(object sender, EventArgs e)
{ {
if (HDCodeLearnHelper.DefaultBitmap != null) if (HDCodeLearnHelper.DefaultBitmap != null)
HDCodeLearnHelper.DefaultBitmap.Dispose(); { HDCodeLearnHelper.DefaultBitmap.Dispose(); }
if (Camera._cam != null)
{
Camera._cam.CloseAll();
}
this.Close(); this.Close();
} }
...@@ -506,14 +511,44 @@ namespace CodeLibrary ...@@ -506,14 +511,44 @@ namespace CodeLibrary
private void btnScanTest_Click(object sender, EventArgs e) private void btnScanTest_Click(object sender, EventArgs e)
{ {
this.Enabled = false; int count = cmbCount.SelectedIndex;
this.Cursor = Cursors.WaitCursor; txtResult.Text = "";
Task.Factory.StartNew(delegate
{ stopwatch.Restart();
//ScanTest(); if (HDCodeLearnHelper.DefaultBitmap != null)
ScanDemo(100); {
}); Bitmap b = (Bitmap)HDCodeLearnHelper.DefaultBitmap.Clone();
} List<CodeInfo> codeList = EyemDecode.Decoder(ref b);
ShowCode(codeList, stopwatch);
}
//Task task1= Task.Factory.StartNew(delegate
//{
// Stopwatch s1 = new Stopwatch();
// s1.Restart();
// if (HDCodeLearnHelper.DefaultBitmap != null)
// {
// Bitmap b = (Bitmap)HDCodeLearnHelper.DefaultBitmap.Clone();
// List<CodeInfo> codeList = EyemDecode.Decoder(ref b);
// ShowCode(codeList, s1);
// }
//});
//Task task2 = Task.Factory.StartNew(delegate
//{
// Stopwatch s2 = new Stopwatch();
// s2.Restart();
// Bitmap bitmap = new Bitmap(@"G:\img\入料T1-10-36-11-530.bmp");
// Bitmap b = (Bitmap)bitmap.Clone();
// List<CodeInfo> codeList = EyemDecode.Decoder(ref b);
// ShowCode(codeList, s2);
//});
//Task.WaitAll(task1, task2);
//txtResult.Text += "\r\n taskEnd:" + stopwatch.Elapsed.ToString();
}
private void ScanDemo(int whileCount = 1) private void ScanDemo(int whileCount = 1)
{ {
......
...@@ -3,16 +3,141 @@ using System; ...@@ -3,16 +3,141 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Drawing.Imaging; using System.Drawing.Imaging;
using System.IO;
using System.Linq; using System.Linq;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Text; using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms;
namespace CodeLibrary namespace CodeLibrary
{ {
public unsafe class EyemDecode public unsafe class EyemDecode
{ {
public static bool IsInit = false;
/// <summary>
/// 识别图像二维码
/// </summary>
/// <param name="bmap">需要手动释放这个bitmap</param>
/// <param name="file">如果传文件的话,bmp传null</param>
/// <returns></returns>
public static List<CodeInfo> ModelDecoder(ref Bitmap bmap, string file = null)
{
if (!IsInit)
{
//string detectorConfigPath = Application.StartupPath + @"\\model\\" + "detect-tiny.cfg";
//string detectorModelPath = Application.StartupPath + @"\\model\\" + "detect-tiny.weights";
//string superResolutionConfigPath = Application.StartupPath + @"\\model\\" + "sr.caffemodel";
//string superResolutionModelPath = Application.StartupPath + @"\\model\\" + "sr.prototxt";
string detectorConfigPath = ".\\model\\" + "detect-tiny.cfg";
string detectorModelPath = ".\\model\\" + "detect-tiny.weights";
string superResolutionConfigPath = ".\\model\\" + "sr.caffemodel";
string superResolutionModelPath = ".\\model\\" + "sr.prototxt";
if (File.Exists(detectorConfigPath)&& File.Exists(detectorModelPath) )
{
int result = eyemInitNNDataCodeModel(detectorConfigPath, detectorModelPath, "", "");
HDLogUtil.info("eyemInitNNDataCodeModel: " + result);
IsInit = true;
Console.WriteLine("eyemInitNNDataCodeModel: " + result);
}
else
{
HDLogUtil.error("eyemInitNNDataCodeModel 模型文件不完整");
}
}
List<CodeInfo> codelist = new List<CodeInfo>();
try
{
//创建图像引用
EyemImage eyemImage;
BitmapData bitmapData = null;
if (file == null)
{
Rectangle rect = new Rectangle(0, 0, bmap.Width, bmap.Height);
bitmapData = bmap.LockBits(rect, ImageLockMode.ReadOnly, bmap.PixelFormat);
eyemImage = new EyemImage();
eyemImage.vpImage = bitmapData.Scan0;
eyemImage.iWidth = rect.Width;
eyemImage.iHeight = rect.Height;
if (bmap.PixelFormat.Equals(PixelFormat.Format8bppIndexed))
{
eyemImage.iChannels = 1;
}else
{
eyemImage.iChannels = 3;
}
eyemImage.iDepth = 0;
if (bitmapData != null)
bmap.UnlockBits(bitmapData);
}
else
{
eyemImageRead(file, 3, out eyemImage);
}
EyemImage outImage ;
//创建扫描区域
EyemRect eyemRect = new EyemRect();
eyemRect.iXs = 0;
eyemRect.iYs = 0;
eyemRect.iWidth = eyemImage.iWidth;
eyemRect.iHeight = eyemImage.iHeight;
string codeType = "QR_CODE|DATA_MATRIX"; //QRCode
int ipNum;
EyemBarCode* tpResults;
DataCodeHandle hObject = null;
try
{
int result = eyemDetectAndDecodeUseNN(eyemImage, eyemRect, out hObject, out tpResults, out ipNum,out outImage);
HDLogUtil.info($"eyemDetectAndDecode:{result},ipNum:{ipNum}");
if (result != 0 || ipNum == 0)
return codelist;
for (int i = 0; i < ipNum; i++)
{
CodeInfo ci = new CodeInfo(Marshal.PtrToStringAnsi(tpResults[i].hText), tpResults[i].iCenterX, tpResults[i].iCenterY);
ci.CodeType = Marshal.PtrToStringAnsi(tpResults[i].hType);
codelist.Add(ci);
}
}
finally
{
if (hObject != null)
{
hObject.Dispose();
}
if (bitmapData != null)
{
try
{
bmap.UnlockBits(bitmapData);
}catch(Exception ex)
{
}
}
if (file != null)
{
eyemImageFree(ref eyemImage);
}
//bmap.Dispose();
}
}
catch (Exception ex)
{
HDLogUtil.error(ex.ToString());
}
//eyemImageFree(eyemImage.ucpImage);
return codelist;
}
/// <summary> /// <summary>
/// 识别图像二维码 /// 识别图像二维码
/// </summary> /// </summary>
...@@ -34,10 +159,18 @@ namespace CodeLibrary ...@@ -34,10 +159,18 @@ namespace CodeLibrary
Rectangle rect = new Rectangle(0, 0, bmap.Width, bmap.Height); Rectangle rect = new Rectangle(0, 0, bmap.Width, bmap.Height);
bitmapData = bmap.LockBits(rect, ImageLockMode.ReadOnly, bmap.PixelFormat); bitmapData = bmap.LockBits(rect, ImageLockMode.ReadOnly, bmap.PixelFormat);
eyemImage = new EyemImage(); eyemImage = new EyemImage();
eyemImage.ucpImage = bitmapData.Scan0; eyemImage.vpImage = bitmapData.Scan0;
eyemImage.iWidth = rect.Width; eyemImage.iWidth = rect.Width;
eyemImage.iHeight = rect.Height; eyemImage.iHeight = rect.Height;
eyemImage.iChannel = 0; if (bmap.PixelFormat.Equals(PixelFormat.Format8bppIndexed))
{
eyemImage.iChannels = 1;
}
else
{
eyemImage.iChannels = 3;
}
eyemImage.iDepth = 0;
} }
else else
{ {
...@@ -76,7 +209,7 @@ namespace CodeLibrary ...@@ -76,7 +209,7 @@ namespace CodeLibrary
if (bitmapData != null) if (bitmapData != null)
bmap.UnlockBits(bitmapData); bmap.UnlockBits(bitmapData);
if (file != null) if (file != null)
eyemImageFree(eyemImage.ucpImage); eyemImageFree(ref eyemImage);
//bmap.Dispose(); //bmap.Dispose();
} }
} }
...@@ -96,6 +229,12 @@ namespace CodeLibrary ...@@ -96,6 +229,12 @@ namespace CodeLibrary
return eyemDetectAndDecodeFree(handle); return eyemDetectAndDecodeFree(handle);
} }
} }
//基于深度学习读码程序(仅支持QR、DataMatrix)
[DllImport("eyemLib.dll", CharSet = CharSet.None, CallingConvention = CallingConvention.Cdecl)]
private static extern int eyemDetectAndDecodeUseNN(EyemImage tpImage, EyemRect tpRoi, out DataCodeHandle hObject, out EyemBarCode* tpResults, out int ipNum, out EyemImage tpDstImg);
//加载模型配置文件
[DllImport("eyemLib.dll", CharSet = CharSet.None, CallingConvention = CallingConvention.Cdecl)]
private static extern int eyemInitNNDataCodeModel(string detectorConfigPath, string detectorModelPath, string superResolutionConfigPath, string superResolutionModelPath);
[DllImport("eyemLib.dll", CharSet = CharSet.None, CallingConvention = CallingConvention.Cdecl)] [DllImport("eyemLib.dll", CharSet = CharSet.None, CallingConvention = CallingConvention.Cdecl)]
private static extern int eyemDetectAndDecode(EyemImage tpImage, EyemRect tpRoi, string fileName, string strCodeType, out DataCodeHandle hObject, out EyemBarCode* tpResults, out int ipNum, bool bUseNiBlack, int iBlockSize, int iRangeC, int iSymbolMin, int iSymbolMax, double dScaleUpAndDown = 0.5, double dToleErr = 0.5, double dMinorStep = 1.0); private static extern int eyemDetectAndDecode(EyemImage tpImage, EyemRect tpRoi, string fileName, string strCodeType, out DataCodeHandle hObject, out EyemBarCode* tpResults, out int ipNum, bool bUseNiBlack, int iBlockSize, int iRangeC, int iSymbolMin, int iSymbolMax, double dScaleUpAndDown = 0.5, double dToleErr = 0.5, double dMinorStep = 1.0);
/* /*
...@@ -131,24 +270,29 @@ namespace CodeLibrary ...@@ -131,24 +270,29 @@ namespace CodeLibrary
[DllImport("eyemLib.dll", CharSet = CharSet.None, CallingConvention = CallingConvention.Cdecl)] [DllImport("eyemLib.dll", CharSet = CharSet.None, CallingConvention = CallingConvention.Cdecl)]
private static extern int eyemImageRead(string filename, int iFalgs, out EyemImage ucpImage); private static extern int eyemImageRead(string filename, int iFalgs, out EyemImage ucpImage);
/// <summary> ///// <summary>
/// 释放图像资源 ///// 释放图像资源
/// </summary> ///// </summary>
/// <param name="ipImage"></param> ///// <param name="ipImage"></param>
//[DllImport("eyemLib.dll", CharSet = CharSet.None, CallingConvention = CallingConvention.Cdecl)]
//private static extern void eyemImageFree(IntPtr ipImage);
//释放图像资源
[DllImport("eyemLib.dll", CharSet = CharSet.None, CallingConvention = CallingConvention.Cdecl)] [DllImport("eyemLib.dll", CharSet = CharSet.None, CallingConvention = CallingConvention.Cdecl)]
private static extern void eyemImageFree(IntPtr ipImage); private static extern void eyemImageFree(ref EyemImage tpImage);
//释放工具 //释放工具
[DllImport("eyemLib.dll", CharSet = CharSet.None, CallingConvention = CallingConvention.Cdecl)] [DllImport("eyemLib.dll", CharSet = CharSet.None, CallingConvention = CallingConvention.Cdecl)]
private static extern bool eyemDetectAndDecodeFree(IntPtr hObject); private static extern bool eyemDetectAndDecodeFree(IntPtr hObject);
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public struct EyemImage public struct EyemImage
{ {
public IntPtr ucpImage; // 地址 public IntPtr vpImage; // 地址
public int iWidth; // 图像内存 x 方向大小 public int iWidth; // 图像内存 x 方向大小
public int iHeight; // 图像内存 y 方向大小 public int iHeight; // 图像内存 y 方向大小
public int iChannel; // 图像通道数 public int iDepth; // 图像位深度(详见说明)
public int iChannels; // 图像通道数
} }
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public struct EyemRect public struct EyemRect
......
...@@ -36,4 +36,5 @@ selCamera,请先选择相机,Please select camera ...@@ -36,4 +36,5 @@ selCamera,请先选择相机,Please select camera
selImage,请先选择图片,Please select picture selImage,请先选择图片,Please select picture
title,提示,Notice title,提示,Notice
imageIsNull,获取二维码图片为空,Get the two-dimensional code picture is empty imageIsNull,获取二维码图片为空,Get the two-dimensional code picture is empty
sureDelete,确定删除文件:,Make sure to delete the file:
\ No newline at end of file \ No newline at end of file
sureDelete,确定删除文件:,Make sure to delete the file:
FrmCodeDecode_btnScanTest_Text,新算法解码,New algorithm decoding
\ No newline at end of file \ No newline at end of file
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
[net]
# Testing
batch=1
subdivisions=1
# Training
# batch=64
# subdivisions=64
width=608
height=608
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=21
activation=linear
[yolo]
mask = 3,4,5
anchors = 10,14, 23,27, 37,58, 81,82, 135,169, 344,319
classes=2
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=21
activation=linear
[yolo]
mask = 0,1,2
anchors = 10,14, 23,27, 37,58, 81,82, 135,169, 344,319
classes=2
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
}
}
此文件太大,无法显示。
此文件类型无法预览
//基于深度学习读码程序(仅支持QR、DataMatrix)
[DllImport("eyemLib.dll", CharSet = CharSet.None, CallingConvention = CallingConvention.Cdecl)]
private static extern int eyemDetectAndDecodeUseNN(EyemImage tpImage, EyemRect tpRoi, out DataCodeHandle hObject, out EyemBarCode* tpResults, out int ipNum, out EyemImage tpDstImg);
//加载模型配置文件
[DllImport("eyemLib.dll", CharSet = CharSet.None, CallingConvention = CallingConvention.Cdecl)]
private static extern int eyemInitNNDataCodeModel(string detectorConfigPath, string detectorModelPath, string superResolutionConfigPath, string superResolutionModelPath);
detectorConfigPath=detect-tiny.cfg
detectorModelPath=detect-tiny.weights
superResolutionConfigPath=sr.caffemodel
superResolutionModelPath=sr.prototxt
\ No newline at end of file \ No newline at end of file
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!