AOI

 找回密码
 立即注册
查看: 17721|回复: 0

C++调用WITIAI模型

[复制链接]

98

主题

126

帖子

713

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
713
发表于 2021-11-22 22:51:15 | 显示全部楼层 |阅读模式
C++调用WITIAI模型:
(1)WITIAI软件训练好AI模型后,采用C++调用AI模型,得到分割分类图。
(2)halcon、opencv的接口都预留了,满足工业需求;
(3)Demo代码如下:
  1. // CplusDemos.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
  2. //
  3. #include <torch/script.h>
  4. #include <torch/utils.h>
  5. #include <iostream>
  6. #include <string>
  7. #include <time.h>
  8. #include <vector>
  9. #include <memory.h>
  10. #include <windows.h>
  11. #include <atlstr.h>
  12. #include <initguid.h>
  13. #include <setupapi.h>
  14. #include <opencv2/opencv.hpp>
  15. using namespace std;
  16. using namespace cv;

  17. typedef void(*pload_module)(char* module_path, int GPUindex);
  18. typedef void(*pPredictRGBImage)(char* input_image_path, char* output_image_path, int sliceImageSize, double overRate, double image_threshold, int classnum, int GPUindex);
  19. typedef unsigned char*(*pPredictRGBImagePath2Intptr)(char* input_image_path, int sliceImageSize, double overRate, double image_threshold, int classnum, int GPUindex);
  20. typedef unsigned char*(*pPredictRGBImageMat2Intptr)(int aWidth, int aHeight, int aChannel, unsigned char* aBytes, int sliceImageSize, double overRate, double image_threshold, int classnum, int GPUindex);
  21. typedef void(*pPredictRGBImageMat2Path)(int aWidth, int aHeight, int aChannel, unsigned char* aBytes, char* output_image_path, int sliceImageSize, double overRate, double image_threshold, int classnum, int GPUindex);

  22. typedef void(*pPredictGrayImage)(char* input_image_path, char* output_image_path, int sliceImageSize, double overRate, double image_threshold, int classnum, int GPUindex);
  23. typedef unsigned char*(*pPredictGrayImagePath2Intptr)(char* input_image_path, int sliceImageSize, double overRate, double image_threshold, int classnum, int GPUindex);
  24. typedef unsigned char*(*pPredictGrayImageMat2Intptr)(int aWidth, int aHeight, int aChannel, unsigned char* aBytes, int sliceImageSize, double overRate, double image_threshold, int classnum, int GPUindex);
  25. typedef void(*pPredictGrayImageMat2Path)(int aWidth, int aHeight, int aChannel, unsigned char* aBytes, char* output_image_path, int sliceImageSize, double overRate, double image_threshold, int classnum, int GPUindex);


  26. void fun1()
  27. {
  28.         HINSTANCE HDLL = LoadLibrary("PytorchApi.dll");//加载动态链接库MyDll.dll文件;
  29.         if (HDLL != NULL)
  30.         {
  31.                 ///////////////////////// RGB /////////////////////////////////////
  32.                 //
  33.                 char* model_path = "D:/2-LearningCode/994-WiTiAi/5_Demos/CplusDemos/CplusDemos/x64/Release/rgb_model.WITIAI";
  34.                 //char* input_image_path = "D:/Release/rgb.jpg";
  35.                 char* input_image_path = "D:/2-LearningCode/994-WiTiAi/5_Demos/CplusDemos/CplusDemos/x64/Release/rgb.jpg";
  36.                 char* output_image_path = "D:/2-LearningCode/994-WiTiAi/5_Demos/CplusDemos/CplusDemos/x64/Release/rgb_1.png";
  37.                 int sliceImageSize = 256;
  38.                 double overRate = 0;
  39.                 double image_threshold = 0.5;
  40.                 int classnum = 4;
  41.                 int GPUindex = 0;
  42.                 // Load model
  43.                 const char* FunctionName0 = "load_module";
  44.                 pload_module Callload_module = (pload_module)GetProcAddress(HDLL, FunctionName0);
  45.                 (*Callload_module)(model_path, GPUindex);

  46.                 // method1
  47.                 const char* FunctionName1 = "PredictRGBImage";
  48.                 pPredictRGBImage CallPredictRGBImage = (pPredictRGBImage)GetProcAddress(HDLL, FunctionName1);
  49.                 (*CallPredictRGBImage)(input_image_path, output_image_path, sliceImageSize, overRate, image_threshold, classnum, GPUindex);

  50.                 // method2
  51.                 Mat image = cv::imread(input_image_path, 1);  // RGB
  52.                 int aHeight = image.rows;
  53.                 int aWidth = image.cols;
  54.                 int aChannel = image.channels();
  55.                 const char* FunctionName2 = "PredictRGBImagePath2Intptr";
  56.                 pPredictRGBImagePath2Intptr CallPredictRGBImagePath2Intptr = (pPredictRGBImagePath2Intptr)GetProcAddress(HDLL, FunctionName2);
  57.                 unsigned char* aBytes = new unsigned char[aHeight * aWidth * 1];
  58.                 aBytes = (*CallPredictRGBImagePath2Intptr)(input_image_path, sliceImageSize, overRate, image_threshold, classnum, GPUindex);
  59.                 Mat frame(aHeight, aWidth, CV_MAKETYPE(CV_8U, 1), aBytes);
  60.                 cv::imwrite("D:/2-LearningCode/994-WiTiAi/5_Demos/CplusDemos/CplusDemos/x64/Release/rgb_2.png", frame);

  61.                 // method3
  62.                 Mat image3 = cv::imread(input_image_path, 1);  // RGB
  63.                 int aHeight3 = image3.rows;
  64.                 int aWidth3 = image3.cols;
  65.                 int aChannel3 = image3.channels();
  66.                 unsigned char* ucImg3 = new unsigned char[aHeight3 * aWidth3 * aChannel3];
  67.                 std::memcpy(ucImg3, image3.data, aHeight3 * aWidth3 * aChannel3 * sizeof(unsigned char));
  68.                 const char* FunctionName3 = "PredictRGBImageMat2Intptr";
  69.                 pPredictRGBImageMat2Intptr CallPredictRGBImageMat2Intptr = (pPredictRGBImageMat2Intptr)GetProcAddress(HDLL, FunctionName3);
  70.                 unsigned char* aBytes1 = new unsigned char[aHeight3 * aWidth3 * 1];
  71.                 aBytes1 = (*CallPredictRGBImageMat2Intptr)(aWidth3, aHeight3, aChannel3, ucImg3, sliceImageSize, overRate, image_threshold, classnum, GPUindex);
  72.                 Mat frame1(aHeight3, aWidth3, CV_MAKETYPE(CV_8U, 1), aBytes1);
  73.                 cv::imwrite("D:/2-LearningCode/994-WiTiAi/5_Demos/CplusDemos/CplusDemos/x64/Release/rgb_3.png", frame1);


  74.                 // method4
  75.                 Mat image4 = cv::imread(input_image_path, 1);  // RGB
  76.                 int aHeight4 = image4.rows;
  77.                 int aWidth4 = image4.cols;
  78.                 int aChannel4 = image4.channels();
  79.                 unsigned char* ucImg4 = new unsigned char[aHeight4 * aWidth4 * aChannel4];
  80.                 std::memcpy(ucImg4, image4.data, aHeight4 * aWidth4 * aChannel4 * sizeof(unsigned char));
  81.                 const char* FunctionName4 = "PredictRGBImageMat2Path";
  82.                 pPredictRGBImageMat2Path CallPredictRGBImageMat2Path = (pPredictRGBImageMat2Path)GetProcAddress(HDLL, FunctionName4);
  83.                 char* output_image_path4 = "D:/2-LearningCode/994-WiTiAi/5_Demos/CplusDemos/CplusDemos/x64/Release/rgb_4.png";
  84.                 (*CallPredictRGBImageMat2Path)(aWidth4, aHeight4, aChannel4, ucImg4, output_image_path4, sliceImageSize, overRate, image_threshold, classnum, GPUindex);
  85.                 //
  86.                 ///////////////////////// RGB /////////////////////////////////////
  87.                 //
  88.                 //
  89.                 ///////////////////////// Gray /////////////////////////////////////
  90.                 //
  91.                 char* model_path0 = "D:/2-LearningCode/994-WiTiAi/5_Demos/CplusDemos/CplusDemos/x64/Release/gray_model.WITIAI";
  92.                 char* input_image_path0 = "D:/2-LearningCode/994-WiTiAi/5_Demos/CplusDemos/CplusDemos/x64/Release/gray.jpg";
  93.                 char* output_image_path0 = "D:/2-LearningCode/994-WiTiAi/5_Demos/CplusDemos/CplusDemos/x64/Release/gray_1.png";
  94.                 int sliceImageSize0 = 512;
  95.                 //double overRate = 0;
  96.                 //double image_threshold = 0.5;
  97.                 //int classnum = 4;
  98.                 //int GPUindex = 0;
  99.                 // Load model
  100.                 const char* FunctionName5 = "load_module";
  101.                 pload_module Callload_module_gray = (pload_module)GetProcAddress(HDLL, FunctionName5);
  102.                 (*Callload_module_gray)(model_path0, GPUindex);

  103.                 // method1
  104.                 const char* FunctionName6 = "PredictGrayImage";
  105.                 pPredictGrayImage CallPredictGrayImage = (pPredictGrayImage)GetProcAddress(HDLL, FunctionName6);
  106.                 (*CallPredictGrayImage)(input_image_path0, output_image_path0, sliceImageSize0, overRate, image_threshold, classnum, GPUindex);

  107.                 // method2
  108.                 Mat image_gray = cv::imread(input_image_path0, 0);  // Gray
  109.                 int aHeight_gray = image_gray.rows;
  110.                 int aWidth_gray = image_gray.cols;
  111.                 int aChannel_gray = image_gray.channels();
  112.                 const char* FunctionName7 = "PredictGrayImagePath2Intptr";
  113.                 pPredictGrayImagePath2Intptr CallPredictGrayImagePath2Intptr = (pPredictGrayImagePath2Intptr)GetProcAddress(HDLL, FunctionName7);
  114.                 unsigned char* aBytes_gray = new unsigned char[aHeight_gray * aWidth_gray * 1];
  115.                 aBytes_gray = (*CallPredictRGBImagePath2Intptr)(input_image_path0, sliceImageSize0, overRate, image_threshold, classnum, GPUindex);
  116.                 Mat frame_gray(aHeight_gray, aWidth_gray, CV_MAKETYPE(CV_8U, 1), aBytes_gray);
  117.                 cv::imwrite("D:/2-LearningCode/994-WiTiAi/5_Demos/CplusDemos/CplusDemos/x64/Release/gray_2.png", frame_gray);

  118.                 // method3
  119.                 Mat image3_gray = cv::imread(input_image_path0, 0);  // Gray
  120.                 int aHeight3_gray = image3_gray.rows;
  121.                 int aWidth3_gray = image3_gray.cols;
  122.                 int aChannel3_gray = image3_gray.channels();
  123.                 unsigned char* ucImg3_gray = new unsigned char[aHeight3_gray * aWidth3_gray * aChannel3_gray];
  124.                 std::memcpy(ucImg3_gray, image3_gray.data, aHeight3_gray * aWidth3_gray * aChannel3_gray * sizeof(unsigned char));
  125.                 const char* FunctionName8 = "PredictGrayImageMat2Intptr";
  126.                 pPredictGrayImageMat2Intptr CallPredictGrayImageMat2Intptr = (pPredictGrayImageMat2Intptr)GetProcAddress(HDLL, FunctionName8);
  127.                 unsigned char* aBytes1_gray = new unsigned char[aHeight3 * aWidth3 * 1];
  128.                 aBytes1_gray = (*CallPredictGrayImageMat2Intptr)(aWidth3_gray, aHeight3_gray, aChannel3_gray, ucImg3_gray, sliceImageSize0, overRate, image_threshold, classnum, GPUindex);
  129.                 Mat frame1_gray(aHeight3_gray, aWidth3_gray, CV_MAKETYPE(CV_8U, 1), aBytes1_gray);
  130.                 cv::imwrite("D:/2-LearningCode/994-WiTiAi/5_Demos/CplusDemos/CplusDemos/x64/Release/gray_3.png", frame1_gray);

  131.                 // method4
  132.                 Mat image4_gray = cv::imread(input_image_path0, 0);  // Gray
  133.                 int aHeight4_gray = image4_gray.rows;
  134.                 int aWidth4_gray = image4_gray.cols;
  135.                 int aChannel4_gray = image4_gray.channels();
  136.                 unsigned char* ucImg4_gray = new unsigned char[aHeight4_gray * aWidth4_gray * aChannel4_gray];
  137.                 std::memcpy(ucImg4_gray, image4_gray.data, aHeight4_gray * aWidth4_gray * aChannel4_gray * sizeof(unsigned char));
  138.                 const char* FunctionName9 = "PredictGrayImageMat2Path";
  139.                 pPredictGrayImageMat2Path CallPredictGrayImageMat2Path = (pPredictGrayImageMat2Path)GetProcAddress(HDLL, FunctionName9);
  140.                 char* output_image_path4_gray = "D:/2-LearningCode/994-WiTiAi/5_Demos/CplusDemos/CplusDemos/x64/Release/gray_4.png";
  141.                 (*CallPredictGrayImageMat2Path)(aWidth4_gray, aHeight4_gray, aChannel4_gray, ucImg4_gray, output_image_path4_gray, sliceImageSize0, overRate, image_threshold, classnum, GPUindex);
  142.                 //
  143.                 ///////////////////////// Gray /////////////////////////////////////


  144.                 //try
  145.                 //{
  146.                 //        FreeLibrary(HDLL);   //卸载MyDll.dll文件;
  147.                 //}
  148.                 //catch(exception ex)
  149.                 //{
  150.                 //        std::cout << "catch(FreeLibrary(HDLL))\n";
  151.                 //}
  152.         }

  153. }

  154. void fun2()
  155. {
  156.         HINSTANCE HDLL = LoadLibrary("PytorchApi1.dll");//加载动态链接库MyDll.dll文件;
  157.         if (HDLL != NULL)
  158.         {
  159.                 ///////////////////////// RGB /////////////////////////////////////
  160.                 //
  161.                 char* model_path = "D:/2-LearningCode/994-WiTiAi/5_Demos/CplusDemos/CplusDemos/x64/Release/rgb_model.WITIAI";
  162.                 //char* input_image_path = "D:/Release/rgb.jpg";
  163.                 char* input_image_path = "D:/2-LearningCode/994-WiTiAi/5_Demos/CplusDemos/CplusDemos/x64/Release/rgb.jpg";
  164.                 char* output_image_path = "D:/2-LearningCode/994-WiTiAi/5_Demos/CplusDemos/CplusDemos/x64/Release/rgb_1.png";
  165.                 int sliceImageSize = 256;
  166.                 double overRate = 0;
  167.                 double image_threshold = 0.5;
  168.                 int classnum = 4;
  169.                 int GPUindex = 0;
  170.                 // Load model
  171.                 const char* FunctionName0 = "load_module";
  172.                 pload_module Callload_module = (pload_module)GetProcAddress(HDLL, FunctionName0);
  173.                 (*Callload_module)(model_path, GPUindex);

  174.                 // method1
  175.                 const char* FunctionName1 = "PredictRGBImage";
  176.                 pPredictRGBImage CallPredictRGBImage = (pPredictRGBImage)GetProcAddress(HDLL, FunctionName1);
  177.                 (*CallPredictRGBImage)(input_image_path, output_image_path, sliceImageSize, overRate, image_threshold, classnum, GPUindex);

  178.                 // method2
  179.                 Mat image = cv::imread(input_image_path, 1);  // RGB
  180.                 int aHeight = image.rows;
  181.                 int aWidth = image.cols;
  182.                 int aChannel = image.channels();
  183.                 const char* FunctionName2 = "PredictRGBImagePath2Intptr";
  184.                 pPredictRGBImagePath2Intptr CallPredictRGBImagePath2Intptr = (pPredictRGBImagePath2Intptr)GetProcAddress(HDLL, FunctionName2);
  185.                 unsigned char* aBytes = new unsigned char[aHeight * aWidth * 1];
  186.                 aBytes = (*CallPredictRGBImagePath2Intptr)(input_image_path, sliceImageSize, overRate, image_threshold, classnum, GPUindex);
  187.                 Mat frame(aHeight, aWidth, CV_MAKETYPE(CV_8U, 1), aBytes);
  188.                 cv::imwrite("D:/2-LearningCode/994-WiTiAi/5_Demos/CplusDemos/CplusDemos/x64/Release/rgb_2.png", frame);

  189.                 // method3
  190.                 Mat image3 = cv::imread(input_image_path, 1);  // RGB
  191.                 int aHeight3 = image3.rows;
  192.                 int aWidth3 = image3.cols;
  193.                 int aChannel3 = image3.channels();
  194.                 unsigned char* ucImg3 = new unsigned char[aHeight3 * aWidth3 * aChannel3];
  195.                 std::memcpy(ucImg3, image3.data, aHeight3 * aWidth3 * aChannel3 * sizeof(unsigned char));
  196.                 const char* FunctionName3 = "PredictRGBImageMat2Intptr";
  197.                 pPredictRGBImageMat2Intptr CallPredictRGBImageMat2Intptr = (pPredictRGBImageMat2Intptr)GetProcAddress(HDLL, FunctionName3);
  198.                 unsigned char* aBytes1 = new unsigned char[aHeight3 * aWidth3 * 1];
  199.                 aBytes1 = (*CallPredictRGBImageMat2Intptr)(aWidth3, aHeight3, aChannel3, ucImg3, sliceImageSize, overRate, image_threshold, classnum, GPUindex);
  200.                 Mat frame1(aHeight3, aWidth3, CV_MAKETYPE(CV_8U, 1), aBytes1);
  201.                 cv::imwrite("D:/2-LearningCode/994-WiTiAi/5_Demos/CplusDemos/CplusDemos/x64/Release/rgb_3.png", frame1);


  202.                 // method4
  203.                 Mat image4 = cv::imread(input_image_path, 1);  // RGB
  204.                 int aHeight4 = image4.rows;
  205.                 int aWidth4 = image4.cols;
  206.                 int aChannel4 = image4.channels();
  207.                 unsigned char* ucImg4 = new unsigned char[aHeight4 * aWidth4 * aChannel4];
  208.                 std::memcpy(ucImg4, image4.data, aHeight4 * aWidth4 * aChannel4 * sizeof(unsigned char));
  209.                 const char* FunctionName4 = "PredictRGBImageMat2Path";
  210.                 pPredictRGBImageMat2Path CallPredictRGBImageMat2Path = (pPredictRGBImageMat2Path)GetProcAddress(HDLL, FunctionName4);
  211.                 char* output_image_path4 = "D:/2-LearningCode/994-WiTiAi/5_Demos/CplusDemos/CplusDemos/x64/Release/rgb_4.png";
  212.                 (*CallPredictRGBImageMat2Path)(aWidth4, aHeight4, aChannel4, ucImg4, output_image_path4, sliceImageSize, overRate, image_threshold, classnum, GPUindex);
  213.                 //
  214.                 ///////////////////////// RGB /////////////////////////////////////
  215.                 //
  216.                 //
  217.                 ///////////////////////// Gray /////////////////////////////////////
  218.                 //
  219.                 char* model_path0 = "D:/2-LearningCode/994-WiTiAi/5_Demos/CplusDemos/CplusDemos/x64/Release/gray_model.WITIAI";
  220.                 char* input_image_path0 = "D:/2-LearningCode/994-WiTiAi/5_Demos/CplusDemos/CplusDemos/x64/Release/gray.jpg";
  221.                 char* output_image_path0 = "D:/2-LearningCode/994-WiTiAi/5_Demos/CplusDemos/CplusDemos/x64/Release/gray_1.png";
  222.                 int sliceImageSize0 = 512;
  223.                 //double overRate = 0;
  224.                 //double image_threshold = 0.5;
  225.                 //int classnum = 4;
  226.                 //int GPUindex = 0;
  227.                 // Load model
  228.                 const char* FunctionName5 = "load_module";
  229.                 pload_module Callload_module_gray = (pload_module)GetProcAddress(HDLL, FunctionName5);
  230.                 (*Callload_module_gray)(model_path0, GPUindex);

  231.                 // method1
  232.                 const char* FunctionName6 = "PredictGrayImage";
  233.                 pPredictGrayImage CallPredictGrayImage = (pPredictGrayImage)GetProcAddress(HDLL, FunctionName6);
  234.                 (*CallPredictGrayImage)(input_image_path0, output_image_path0, sliceImageSize0, overRate, image_threshold, classnum, GPUindex);

  235.                 // method2
  236.                 Mat image_gray = cv::imread(input_image_path0, 0);  // Gray
  237.                 int aHeight_gray = image_gray.rows;
  238.                 int aWidth_gray = image_gray.cols;
  239.                 int aChannel_gray = image_gray.channels();
  240.                 const char* FunctionName7 = "PredictGrayImagePath2Intptr";
  241.                 pPredictGrayImagePath2Intptr CallPredictGrayImagePath2Intptr = (pPredictGrayImagePath2Intptr)GetProcAddress(HDLL, FunctionName7);
  242.                 unsigned char* aBytes_gray = new unsigned char[aHeight_gray * aWidth_gray * 1];
  243.                 aBytes_gray = (*CallPredictRGBImagePath2Intptr)(input_image_path0, sliceImageSize0, overRate, image_threshold, classnum, GPUindex);
  244.                 Mat frame_gray(aHeight_gray, aWidth_gray, CV_MAKETYPE(CV_8U, 1), aBytes_gray);
  245.                 cv::imwrite("D:/2-LearningCode/994-WiTiAi/5_Demos/CplusDemos/CplusDemos/x64/Release/gray_2.png", frame_gray);

  246.                 // method3
  247.                 Mat image3_gray = cv::imread(input_image_path0, 0);  // Gray
  248.                 int aHeight3_gray = image3_gray.rows;
  249.                 int aWidth3_gray = image3_gray.cols;
  250.                 int aChannel3_gray = image3_gray.channels();
  251.                 unsigned char* ucImg3_gray = new unsigned char[aHeight3_gray * aWidth3_gray * aChannel3_gray];
  252.                 std::memcpy(ucImg3_gray, image3_gray.data, aHeight3_gray * aWidth3_gray * aChannel3_gray * sizeof(unsigned char));
  253.                 const char* FunctionName8 = "PredictGrayImageMat2Intptr";
  254.                 pPredictGrayImageMat2Intptr CallPredictGrayImageMat2Intptr = (pPredictGrayImageMat2Intptr)GetProcAddress(HDLL, FunctionName8);
  255.                 unsigned char* aBytes1_gray = new unsigned char[aHeight3 * aWidth3 * 1];
  256.                 aBytes1_gray = (*CallPredictGrayImageMat2Intptr)(aWidth3_gray, aHeight3_gray, aChannel3_gray, ucImg3_gray, sliceImageSize0, overRate, image_threshold, classnum, GPUindex);
  257.                 Mat frame1_gray(aHeight3_gray, aWidth3_gray, CV_MAKETYPE(CV_8U, 1), aBytes1_gray);
  258.                 cv::imwrite("D:/2-LearningCode/994-WiTiAi/5_Demos/CplusDemos/CplusDemos/x64/Release/gray_3.png", frame1_gray);

  259.                 // method4
  260.                 Mat image4_gray = cv::imread(input_image_path0, 0);  // Gray
  261.                 int aHeight4_gray = image4_gray.rows;
  262.                 int aWidth4_gray = image4_gray.cols;
  263.                 int aChannel4_gray = image4_gray.channels();
  264.                 unsigned char* ucImg4_gray = new unsigned char[aHeight4_gray * aWidth4_gray * aChannel4_gray];
  265.                 std::memcpy(ucImg4_gray, image4_gray.data, aHeight4_gray * aWidth4_gray * aChannel4_gray * sizeof(unsigned char));
  266.                 const char* FunctionName9 = "PredictGrayImageMat2Path";
  267.                 pPredictGrayImageMat2Path CallPredictGrayImageMat2Path = (pPredictGrayImageMat2Path)GetProcAddress(HDLL, FunctionName9);
  268.                 char* output_image_path4_gray = "D:/2-LearningCode/994-WiTiAi/5_Demos/CplusDemos/CplusDemos/x64/Release/gray_4.png";
  269.                 (*CallPredictGrayImageMat2Path)(aWidth4_gray, aHeight4_gray, aChannel4_gray, ucImg4_gray, output_image_path4_gray, sliceImageSize0, overRate, image_threshold, classnum, GPUindex);
  270.                 //
  271.                 ///////////////////////// Gray /////////////////////////////////////


  272.                 //try
  273.                 //{
  274.                 //        FreeLibrary(HDLL);   //卸载MyDll.dll文件;
  275.                 //}
  276.                 //catch(exception ex)
  277.                 //{
  278.                 //        std::cout << "catch(FreeLibrary(HDLL))\n";
  279.                 //}
  280.         }

  281. }

  282. int main()
  283. {
  284.         std::cout << "Hello World!\n";
  285.         // 注释:当有2个AI模型参与调度时, PytorchApi.dll,加载第一个模型,PytorchApi1.dll,加载第二个模型

  286.         fun1();

  287.         //fun2();

  288.         system("pause");
  289.         return 0;
  290. }

复制代码







回复

使用道具 举报

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

本版积分规则

Opencv|MATLAB|Python|WiTiAi ( 蜀ICP备2021019707号 )

GMT+8, 2024-4-27 00:12 , Processed in 0.074897 second(s), 19 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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