请选择 进入手机版 | 继续访问电脑版

Hello Mat

 找回密码
 立即注册
查看: 4970|回复: 1

WiTiAi软件help帮助文档

[复制链接]

10

主题

11

帖子

40

金钱

版主

Rank: 7Rank: 7Rank: 7

积分
76
发表于 2020-12-9 20:25:27 | 显示全部楼层 |阅读模式
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)
  1.             string ImagePath = this.textBox1.Text.ToString();
  2.             int sliceImageSize = 512;
  3.             double overRate = 0.0;
  4.             double image_threshold = 0.5;
  5.             int classnum = 4;
  6.             int GPUindex = 0;
  7.             int ImageChannel = 1;
  8.             string savepath1 = System.Windows.Forms.Application.StartupPath + @"/" + "gray_1.png";
  9.             // 初始化AI模型
  10.             string AImodelpt = @"gray_model.WITIAI";
  11.             // method1
  12.             CallAIDLL.load_module(AImodelpt, GPUindex);
  13.             CallAIDLL.PredictGrayImage(ImagePath, savepath1, sliceImageSize, overRate, image_threshold, classnum, GPUindex);

  14.             // method2 -- halcon12进行调试
  15.             HObject ho_Image = null;
  16.             HTuple Width = 1200, Height = 1200;
  17.             HOperatorSet.GenEmptyObj(out ho_Image);
  18.             ho_Image.Dispose();
  19.             HOperatorSet.ReadImage(out ho_Image, ImagePath);
  20.             HOperatorSet.GetImageSize(ho_Image, out Width, out Height);
  21.             IntPtr p = Marshal.AllocHGlobal(Width.I * Height.I * ImageChannel);
  22.             p = CallAIDLL.PredictGrayImagePath2Intptr(ImagePath, sliceImageSize, overRate, image_threshold, classnum, GPUindex);
  23.             HObject outputImage = null;
  24.             HOperatorSet.GenEmptyObj(out outputImage);
  25.             outputImage.Dispose();
  26.             HOperatorSet.GenImage1Extern(out outputImage, "byte", Width, Height, p, Marshal.GetFunctionPointerForDelegate(callback));
  27.             string savepath2 = System.Windows.Forms.Application.StartupPath + @"/" + "gray_2.png";
  28.             HOperatorSet.WriteImage(outputImage, "png", -1, savepath2);

  29.             // method3 -- halcon12进行调试
  30.             HObject ho_Image1 = null;
  31.             HTuple aWidth = 1200, aHeight = 1200;
  32.             HOperatorSet.GenEmptyObj(out ho_Image1);
  33.             ho_Image1.Dispose();
  34.             HOperatorSet.ReadImage(out ho_Image1, ImagePath);
  35.             HOperatorSet.GetImageSize(ho_Image1, out aWidth, out aHeight);
  36.             // 将图像转化为bytes传入
  37.             HTuple hred, hgreen, hblue, type0, width0, height0;
  38.             HOperatorSet.GetImagePointer1(ho_Image1, out hred, out type0, out width0, out height0);
  39.             //HOperatorSet.GetImagePointer3(ho_Image1, out hred, out hgreen, out hblue, out type0, out width0, out height0);
  40.             byte[] bptr = new byte[aWidth.I * aHeight.I * ImageChannel];
  41.             for (int i = 0; i < (width0.I * height0.I); i++)
  42.             {
  43.                 Marshal.Copy((IntPtr)(hred + i), bptr, i * 1 + 0, 1);
  44.             }
  45.             IntPtr p0 = Marshal.AllocHGlobal(aWidth.I * aHeight.I * ImageChannel);
  46.             Marshal.Copy(bptr, 0, p0, aWidth.I * aHeight.I * ImageChannel);
  47.             // call
  48.             IntPtr p1 = Marshal.AllocHGlobal(aWidth.I * aHeight.I * ImageChannel);
  49.             p1 = CallAIDLL.PredictGrayImageMat2Intptr(aWidth.I, aHeight.I, ImageChannel, p0, sliceImageSize, overRate, image_threshold, classnum, GPUindex);
  50.             HObject outputImage1 = null;
  51.             HOperatorSet.GenEmptyObj(out outputImage1);
  52.             outputImage1.Dispose();
  53.             HOperatorSet.GenImage1Extern(out outputImage1, "byte", aWidth.I, aHeight.I, p1, Marshal.GetFunctionPointerForDelegate(callback));
  54.             string savepath3 = System.Windows.Forms.Application.StartupPath + @"/" + "gray_3.png";
  55.             HOperatorSet.WriteImage(outputImage1, "png", -1, savepath3);

  56.             // method4 -- halcon12进行调试
  57.             string savepath4 = System.Windows.Forms.Application.StartupPath + @"/" + "gray_4.png";
  58.             HObject ho_Image2 = null;
  59.             HTuple aWidth1 = 1200, aHeight1 = 1200;
  60.             HOperatorSet.GenEmptyObj(out ho_Image2);
  61.             ho_Image2.Dispose();
  62.             HOperatorSet.ReadImage(out ho_Image2, ImagePath);
  63.             HOperatorSet.GetImageSize(ho_Image2, out aWidth1, out aHeight1);
  64.             // 将图像转化为bytes传入
  65.             HTuple hred1, hgreen1, hblue1, type1, width1, height1;
  66.             HOperatorSet.GetImagePointer1(ho_Image2, out hred1, out type1, out width1, out height1);
  67.             //HOperatorSet.GetImagePointer3(ho_Image2, out hred1, out hgreen1, out hblue1, out type1, out width1, out height1);
  68.             byte[] bptr1 = new byte[aWidth1.I * aHeight1.I * ImageChannel];
  69.             for (int i = 0; i < (aWidth1.I * aHeight1.I); i++)
  70.             {
  71.                 Marshal.Copy((IntPtr)(hred1 + i), bptr1, i * 1 + 0, 1);
  72.                 //Marshal.Copy((IntPtr)(hgreen1 + i), bptr1, i * 3 + 1, 1);
  73.                 //Marshal.Copy((IntPtr)(hred1 + i), bptr1, i * 3 + 2, 1);
  74.             }
  75.             IntPtr p2 = Marshal.AllocHGlobal(aWidth1.I * aHeight1.I * ImageChannel);
  76.             Marshal.Copy(bptr1, 0, p2, aWidth1.I * aHeight1.I * ImageChannel);
  77.             // call
  78.             CallAIDLL.PredictGrayImageMat2Path(aWidth1, aHeight1, ImageChannel, p2, savepath4, sliceImageSize, overRate, image_threshold, classnum, GPUindex);

  79.             //
  80.             MessageBox.Show("测试完成!!!");
复制代码
8、彩色图像测试(C#-API)
  1. string ImagePath = this.textBox2.Text.ToString();
  2.             int sliceImageSize = 256;
  3.             double overRate = 0.0;
  4.             double image_threshold = 0.5;
  5.             int classnum = 4;
  6.             int GPUindex = 0;
  7.             int ImageChannel = 3;
  8.             string savepath1 = System.Windows.Forms.Application.StartupPath + @"/" + "rgb_1.png";
  9.             // 初始化AI模型
  10.             string AImodelpt = @"rgb_model.WITIAI";
  11.             // method1
  12.             CallAIDLL.load_module(AImodelpt, GPUindex);
  13.             CallAIDLL.PredictRGBImage(ImagePath, savepath1, sliceImageSize, overRate, image_threshold, classnum, GPUindex);

  14.             // method2 -- halcon12进行调试
  15.             HObject ho_Image = null;
  16.             HTuple Width = 1200, Height = 1200;
  17.             HOperatorSet.GenEmptyObj(out ho_Image);
  18.             ho_Image.Dispose();
  19.             HOperatorSet.ReadImage(out ho_Image, ImagePath);
  20.             HOperatorSet.GetImageSize(ho_Image, out Width, out Height);
  21.             IntPtr p = Marshal.AllocHGlobal(Width.I * Height.I * ImageChannel);
  22.             p = CallAIDLL.PredictRGBImagePath2Intptr(ImagePath, sliceImageSize, overRate, image_threshold, classnum, GPUindex);
  23.             HObject outputImage = null;
  24.             HOperatorSet.GenEmptyObj(out outputImage);
  25.             outputImage.Dispose();
  26.             HOperatorSet.GenImage1Extern(out outputImage, "byte", Width, Height, p, Marshal.GetFunctionPointerForDelegate(callback));
  27.             string savepath2 = System.Windows.Forms.Application.StartupPath + @"/" + "rgb_2.png";
  28.             HOperatorSet.WriteImage(outputImage, "png", -1, savepath2);

  29.             // method3 -- halcon12进行调试
  30.             HObject ho_Image1 = null;
  31.             HTuple aWidth = 1200, aHeight = 1200;
  32.             HOperatorSet.GenEmptyObj(out ho_Image1);
  33.             ho_Image1.Dispose();
  34.             HOperatorSet.ReadImage(out ho_Image1, ImagePath);
  35.             HOperatorSet.GetImageSize(ho_Image1, out aWidth, out aHeight);
  36.             // 将图像转化为bytes传入
  37.             HTuple hred, hgreen, hblue, type0, width0, height0;
  38.             HOperatorSet.GetImagePointer3(ho_Image1, out hred, out hgreen, out hblue, out type0, out width0, out height0);
  39.             byte[] bptr = new byte[aWidth.I * aHeight.I * ImageChannel];
  40.             for (int i = 0; i < (width0.I * height0.I); i++)
  41.             {
  42.                 Marshal.Copy((IntPtr)(hblue + i), bptr, i * 3 + 0, 1);
  43.                 Marshal.Copy((IntPtr)(hgreen + i), bptr, i * 3 + 1, 1);
  44.                 Marshal.Copy((IntPtr)(hred + i), bptr, i * 3 + 2, 1);
  45.             }
  46.             IntPtr p0 = Marshal.AllocHGlobal(aWidth.I * aHeight.I * ImageChannel);
  47.             Marshal.Copy(bptr, 0, p0, aWidth.I * aHeight.I * ImageChannel);
  48.             // call
  49.             IntPtr p1 = Marshal.AllocHGlobal(aWidth.I * aHeight.I * ImageChannel);
  50.             p1 = CallAIDLL.PredictRGBImageMat2Intptr(aWidth.I, aHeight.I, ImageChannel, p0, sliceImageSize, overRate, image_threshold, classnum, GPUindex);
  51.             HObject outputImage1 = null;
  52.             HOperatorSet.GenEmptyObj(out outputImage1);
  53.             outputImage1.Dispose();
  54.             HOperatorSet.GenImage1Extern(out outputImage1, "byte", aWidth.I, aHeight.I, p1, Marshal.GetFunctionPointerForDelegate(callback));
  55.             string savepath3 = System.Windows.Forms.Application.StartupPath + @"/" + "rgb_3.png";
  56.             HOperatorSet.WriteImage(outputImage1, "png", -1, savepath3);

  57.             // method4 -- halcon12进行调试
  58.             string savepath4 = System.Windows.Forms.Application.StartupPath + @"/" + "rgb_4.png";
  59.             HObject ho_Image2 = null;
  60.             HTuple aWidth1 = 1200, aHeight1 = 1200;
  61.             HOperatorSet.GenEmptyObj(out ho_Image2);
  62.             ho_Image2.Dispose();
  63.             HOperatorSet.ReadImage(out ho_Image2, ImagePath);
  64.             HOperatorSet.GetImageSize(ho_Image2, out aWidth1, out aHeight1);
  65.             // 将图像转化为bytes传入
  66.             HTuple hred1, hgreen1, hblue1, type1, width1, height1;
  67.             HOperatorSet.GetImagePointer3(ho_Image2, out hred1, out hgreen1, out hblue1, out type1, out width1, out height1);
  68.             byte[] bptr1 = new byte[aWidth1.I * aHeight1.I * ImageChannel];
  69.             for (int i = 0; i < (aWidth1.I * aHeight1.I); i++)
  70.             {
  71.                 Marshal.Copy((IntPtr)(hblue1 + i), bptr1, i * 3 + 0, 1);
  72.                 Marshal.Copy((IntPtr)(hgreen1 + i), bptr1, i * 3 + 1, 1);
  73.                 Marshal.Copy((IntPtr)(hred1 + i), bptr1, i * 3 + 2, 1);
  74.             }
  75.             IntPtr p2 = Marshal.AllocHGlobal(aWidth1.I * aHeight1.I * ImageChannel);
  76.             Marshal.Copy(bptr1, 0, p2, aWidth1.I * aHeight1.I * ImageChannel);
  77.             // call
  78.             CallAIDLL.PredictRGBImageMat2Path(aWidth1, aHeight1, ImageChannel, p2, savepath4, sliceImageSize, overRate, image_threshold, classnum, GPUindex);

  79.             //
  80.             MessageBox.Show("OK");
复制代码


参考:
【1】WiTiAi深度学习软件发布






回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Python|Opencv|MATLAB|Halcom.cn ( 蜀ICP备16027072号 )

GMT+8, 2024-3-29 09:17 , Processed in 0.246997 second(s), 24 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表