WiTiAi深度学习软件发布
WiTiAi软件help帮助文档:
1、软件框架 AI基于Pytorch,软件界面C#,部署API C++,标注采用Halcon(仅限1.0版本)。 软件加密:【开发板加密】、【运行板加密】。 开发环境:WIN10教育版 + 64bit + VS2017专业版 + OpenCvSharp3-AnyCPU(OpenCV 4.x wrapper)
Help文档浏览器:Google Chrome(建议不要使用【谷歌极速浏览器】) 1.0版本说明: WITIAI_H12.exe表示Halcon12进行标注开发; WITIAI_H13.exe表示Halcon13进行标注开发; WITIAI_H18.exe表示Halcon18进行标注开发; 2.0版本说明: WITIAI_Opencv.exe表示Opencv进行标注开发; 2、软件功能 本软件用于实现图像的视觉算法处理,包括图像尺寸测量、AI深度学习的图像分割检测。 数据标注在主界面可以采用【点】、【线】、【圆】、【矩形】、【草绘】、【多边形】、【直线】、【椭圆】、【带角度矩形】、【描点】等多种标注方式。 对于【描点】标注,用户也可以进行特定位置描点,描点的位置默认要在此位置进行样本的构建。 标注【导入】、【导出】、【删除】,数据显示等; 注:图像尺寸测量仅供测量使用(采用C#、Halcon开发,可附带开发板软件赠送使用)。 3、软件优势 1)深度学习算法开发0代码化; 2)指定位置标注(防止图像检测过杀); 3)小样本建模能手、C/C++/C# API; 4)2448x2048图像,计算速度3.6FPS; 5)工业级产品检测,检测精度99%+; 6)机台视觉、极简化深度学习模型开发; 7)半导体芯片、电子产品、医疗影像、液晶面板、自然场景等缺陷多分类分割检测; 4、快捷键:部分快捷键功能可能在v1.0和v2.0有差异。
1)对于AI,Ctrl + 鼠标左键点击Form区域,退出标注过程,鼠标可以平移、缩放、实时获取灰度信息; 2)对于AI,Ctrl + S,保存全部图像的标注信息; 3)键盘tab键,在没标注时,按下键盘tab键,可显示标注的Region,再按下tab键,则不显示标注的region; 4)对于图形显示区域,按下键盘Delete键,可以删除鼠标选择的Region; 5)对于图形显示区域,按下键盘数字0键,可以删除鼠标选择的Region; 6)对于图形显示区域,按下键盘数字1键,可以将鼠标选择的Region的标注类别置1(第1类); 7)对于图形显示区域,按下键盘数字2键,可以将鼠标选择的Region的标注类别置2(第2类); 8)对于图形显示区域,按下键盘数字3键,可以将鼠标选择的Region的标注类别置3(第3类); 9)对于图形显示区域,按下键盘数字4键,可以将鼠标选择的Region的标注类别置4(第4类); 10)对于图形显示区域,按下键盘数字5键,可以将鼠标选择的Region的标注类别置5(第5类); 11)对于图形显示区域,按下键盘数字6键,可以将鼠标选择的Region的标注类别置6(第6类); 12)对于图形显示区域,按下键盘数字7键,可以将鼠标选择的Region的标注类别置7(第7类); 13)对于图形显示区域,按下键盘数字8键,可以将鼠标选择的Region的标注类别置8(第8类); 14)对于图形显示区域,按下键盘数字9键,可以将鼠标选择的Region的标注类别置9(第9类); 15)点击界面【Label区域】【鼠标箭头图标】,退出标注,在图形界面窗口,鼠标左键点击,可突出显示鼠标点击的Region; 16)键盘B键,撤销功能,类似实现Windows下的Ctrl + Z功能,在没有标注时,执行B键才有效; 17)键盘W键,在没标注时,按下键盘W键,可突出显示鼠标位置所在的Region; 18)鼠标Ctrl+ Z, 撤销功能,在没有标注时,执行撤销动作; (19)键盘B键,撤销功能,类似实现windows下的Ctrl + Z功能,在没有标注时,执行B键才有效;
(20)键盘W键,在没标注时,按下键盘W键,可突出显示鼠标位置所在的Region; 5、试用版说明 提供试用。
7、灰度图像测试(C#-API)- string ImagePath = this.textBox1.Text.ToString();
- int sliceImageSize = 512;
- double overRate = 0.0;
- double image_threshold = 0.5;
- int classnum = 4;
- int GPUindex = 0;
- int ImageChannel = 1;
- string savepath1 = System.Windows.Forms.Application.StartupPath + @"/" + "gray_1.png";
- // 初始化AI模型
- string AImodelpt = @"gray_model.WITIAI";
- // method1
- CallAIDLL.load_module(AImodelpt, GPUindex);
- CallAIDLL.PredictGrayImage(ImagePath, savepath1, sliceImageSize, overRate, image_threshold, classnum, GPUindex);
- // method2 -- halcon12进行调试
- HObject ho_Image = null;
- HTuple Width = 1200, Height = 1200;
- HOperatorSet.GenEmptyObj(out ho_Image);
- ho_Image.Dispose();
- HOperatorSet.ReadImage(out ho_Image, ImagePath);
- HOperatorSet.GetImageSize(ho_Image, out Width, out Height);
- IntPtr p = Marshal.AllocHGlobal(Width.I * Height.I * ImageChannel);
- p = CallAIDLL.PredictGrayImagePath2Intptr(ImagePath, sliceImageSize, overRate, image_threshold, classnum, GPUindex);
- HObject outputImage = null;
- HOperatorSet.GenEmptyObj(out outputImage);
- outputImage.Dispose();
- HOperatorSet.GenImage1Extern(out outputImage, "byte", Width, Height, p, Marshal.GetFunctionPointerForDelegate(callback));
- string savepath2 = System.Windows.Forms.Application.StartupPath + @"/" + "gray_2.png";
- HOperatorSet.WriteImage(outputImage, "png", -1, savepath2);
- // method3 -- halcon12进行调试
- HObject ho_Image1 = null;
- HTuple aWidth = 1200, aHeight = 1200;
- HOperatorSet.GenEmptyObj(out ho_Image1);
- ho_Image1.Dispose();
- HOperatorSet.ReadImage(out ho_Image1, ImagePath);
- HOperatorSet.GetImageSize(ho_Image1, out aWidth, out aHeight);
- // 将图像转化为bytes传入
- HTuple hred, hgreen, hblue, type0, width0, height0;
- HOperatorSet.GetImagePointer1(ho_Image1, out hred, out type0, out width0, out height0);
- //HOperatorSet.GetImagePointer3(ho_Image1, out hred, out hgreen, out hblue, out type0, out width0, out height0);
- byte[] bptr = new byte[aWidth.I * aHeight.I * ImageChannel];
- for (int i = 0; i < (width0.I * height0.I); i++)
- {
- Marshal.Copy((IntPtr)(hred + i), bptr, i * 1 + 0, 1);
- }
- IntPtr p0 = Marshal.AllocHGlobal(aWidth.I * aHeight.I * ImageChannel);
- Marshal.Copy(bptr, 0, p0, aWidth.I * aHeight.I * ImageChannel);
- // call
- IntPtr p1 = Marshal.AllocHGlobal(aWidth.I * aHeight.I * ImageChannel);
- p1 = CallAIDLL.PredictGrayImageMat2Intptr(aWidth.I, aHeight.I, ImageChannel, p0, sliceImageSize, overRate, image_threshold, classnum, GPUindex);
- HObject outputImage1 = null;
- HOperatorSet.GenEmptyObj(out outputImage1);
- outputImage1.Dispose();
- HOperatorSet.GenImage1Extern(out outputImage1, "byte", aWidth.I, aHeight.I, p1, Marshal.GetFunctionPointerForDelegate(callback));
- string savepath3 = System.Windows.Forms.Application.StartupPath + @"/" + "gray_3.png";
- HOperatorSet.WriteImage(outputImage1, "png", -1, savepath3);
- // method4 -- halcon12进行调试
- string savepath4 = System.Windows.Forms.Application.StartupPath + @"/" + "gray_4.png";
- HObject ho_Image2 = null;
- HTuple aWidth1 = 1200, aHeight1 = 1200;
- HOperatorSet.GenEmptyObj(out ho_Image2);
- ho_Image2.Dispose();
- HOperatorSet.ReadImage(out ho_Image2, ImagePath);
- HOperatorSet.GetImageSize(ho_Image2, out aWidth1, out aHeight1);
- // 将图像转化为bytes传入
- HTuple hred1, hgreen1, hblue1, type1, width1, height1;
- HOperatorSet.GetImagePointer1(ho_Image2, out hred1, out type1, out width1, out height1);
- //HOperatorSet.GetImagePointer3(ho_Image2, out hred1, out hgreen1, out hblue1, out type1, out width1, out height1);
- byte[] bptr1 = new byte[aWidth1.I * aHeight1.I * ImageChannel];
- for (int i = 0; i < (aWidth1.I * aHeight1.I); i++)
- {
- Marshal.Copy((IntPtr)(hred1 + i), bptr1, i * 1 + 0, 1);
- //Marshal.Copy((IntPtr)(hgreen1 + i), bptr1, i * 3 + 1, 1);
- //Marshal.Copy((IntPtr)(hred1 + i), bptr1, i * 3 + 2, 1);
- }
- IntPtr p2 = Marshal.AllocHGlobal(aWidth1.I * aHeight1.I * ImageChannel);
- Marshal.Copy(bptr1, 0, p2, aWidth1.I * aHeight1.I * ImageChannel);
- // call
- CallAIDLL.PredictGrayImageMat2Path(aWidth1, aHeight1, ImageChannel, p2, savepath4, sliceImageSize, overRate, image_threshold, classnum, GPUindex);
- //
- MessageBox.Show("测试完成!!!");
复制代码 8、彩色图像测试(C#-API):
- string ImagePath = this.textBox2.Text.ToString();
- int sliceImageSize = 256;
- double overRate = 0.0;
- double image_threshold = 0.5;
- int classnum = 4;
- int GPUindex = 0;
- int ImageChannel = 3;
- string savepath1 = System.Windows.Forms.Application.StartupPath + @"/" + "rgb_1.png";
- // 初始化AI模型
- string AImodelpt = @"rgb_model.WITIAI";
- // method1
- CallAIDLL.load_module(AImodelpt, GPUindex);
- CallAIDLL.PredictRGBImage(ImagePath, savepath1, sliceImageSize, overRate, image_threshold, classnum, GPUindex);
- // method2 -- halcon12进行调试
- HObject ho_Image = null;
- HTuple Width = 1200, Height = 1200;
- HOperatorSet.GenEmptyObj(out ho_Image);
- ho_Image.Dispose();
- HOperatorSet.ReadImage(out ho_Image, ImagePath);
- HOperatorSet.GetImageSize(ho_Image, out Width, out Height);
- IntPtr p = Marshal.AllocHGlobal(Width.I * Height.I * ImageChannel);
- p = CallAIDLL.PredictRGBImagePath2Intptr(ImagePath, sliceImageSize, overRate, image_threshold, classnum, GPUindex);
- HObject outputImage = null;
- HOperatorSet.GenEmptyObj(out outputImage);
- outputImage.Dispose();
- HOperatorSet.GenImage1Extern(out outputImage, "byte", Width, Height, p, Marshal.GetFunctionPointerForDelegate(callback));
- string savepath2 = System.Windows.Forms.Application.StartupPath + @"/" + "rgb_2.png";
- HOperatorSet.WriteImage(outputImage, "png", -1, savepath2);
- // method3 -- halcon12进行调试
- HObject ho_Image1 = null;
- HTuple aWidth = 1200, aHeight = 1200;
- HOperatorSet.GenEmptyObj(out ho_Image1);
- ho_Image1.Dispose();
- HOperatorSet.ReadImage(out ho_Image1, ImagePath);
- HOperatorSet.GetImageSize(ho_Image1, out aWidth, out aHeight);
- // 将图像转化为bytes传入
- HTuple hred, hgreen, hblue, type0, width0, height0;
- HOperatorSet.GetImagePointer3(ho_Image1, out hred, out hgreen, out hblue, out type0, out width0, out height0);
- byte[] bptr = new byte[aWidth.I * aHeight.I * ImageChannel];
- for (int i = 0; i < (width0.I * height0.I); i++)
- {
- Marshal.Copy((IntPtr)(hblue + i), bptr, i * 3 + 0, 1);
- Marshal.Copy((IntPtr)(hgreen + i), bptr, i * 3 + 1, 1);
- Marshal.Copy((IntPtr)(hred + i), bptr, i * 3 + 2, 1);
- }
- IntPtr p0 = Marshal.AllocHGlobal(aWidth.I * aHeight.I * ImageChannel);
- Marshal.Copy(bptr, 0, p0, aWidth.I * aHeight.I * ImageChannel);
- // call
- IntPtr p1 = Marshal.AllocHGlobal(aWidth.I * aHeight.I * ImageChannel);
- p1 = CallAIDLL.PredictRGBImageMat2Intptr(aWidth.I, aHeight.I, ImageChannel, p0, sliceImageSize, overRate, image_threshold, classnum, GPUindex);
- HObject outputImage1 = null;
- HOperatorSet.GenEmptyObj(out outputImage1);
- outputImage1.Dispose();
- HOperatorSet.GenImage1Extern(out outputImage1, "byte", aWidth.I, aHeight.I, p1, Marshal.GetFunctionPointerForDelegate(callback));
- string savepath3 = System.Windows.Forms.Application.StartupPath + @"/" + "rgb_3.png";
- HOperatorSet.WriteImage(outputImage1, "png", -1, savepath3);
- // method4 -- halcon12进行调试
- string savepath4 = System.Windows.Forms.Application.StartupPath + @"/" + "rgb_4.png";
- HObject ho_Image2 = null;
- HTuple aWidth1 = 1200, aHeight1 = 1200;
- HOperatorSet.GenEmptyObj(out ho_Image2);
- ho_Image2.Dispose();
- HOperatorSet.ReadImage(out ho_Image2, ImagePath);
- HOperatorSet.GetImageSize(ho_Image2, out aWidth1, out aHeight1);
- // 将图像转化为bytes传入
- HTuple hred1, hgreen1, hblue1, type1, width1, height1;
- HOperatorSet.GetImagePointer3(ho_Image2, out hred1, out hgreen1, out hblue1, out type1, out width1, out height1);
- byte[] bptr1 = new byte[aWidth1.I * aHeight1.I * ImageChannel];
- for (int i = 0; i < (aWidth1.I * aHeight1.I); i++)
- {
- Marshal.Copy((IntPtr)(hblue1 + i), bptr1, i * 3 + 0, 1);
- Marshal.Copy((IntPtr)(hgreen1 + i), bptr1, i * 3 + 1, 1);
- Marshal.Copy((IntPtr)(hred1 + i), bptr1, i * 3 + 2, 1);
- }
- IntPtr p2 = Marshal.AllocHGlobal(aWidth1.I * aHeight1.I * ImageChannel);
- Marshal.Copy(bptr1, 0, p2, aWidth1.I * aHeight1.I * ImageChannel);
- // call
- CallAIDLL.PredictRGBImageMat2Path(aWidth1, aHeight1, ImageChannel, p2, savepath4, sliceImageSize, overRate, image_threshold, classnum, GPUindex);
- //
- MessageBox.Show("OK");
复制代码
参考:
【1】WiTiAi深度学习软件发布
|