diff --git a/AIEngineModule/example/test_example.cpp b/AIEngineModule/example/test_example.cpp index 0346522..ddada6a 100644 --- a/AIEngineModule/example/test_example.cpp +++ b/AIEngineModule/example/test_example.cpp @@ -102,7 +102,7 @@ int main(int argc, char *argv[]) GPU_Config gpu; gpu.gpu_0 = true; - gpu.gpu_1 = true; + gpu.gpu_1 = false; AI_Factory->InitALLAIModle(gpu); std::shared_ptr BOE_Edge_Detect = AI_Factory->BOE_Edge_Detect; diff --git a/AlgorithmModule/src/ALLImgCheckAnalysisy.cpp b/AlgorithmModule/src/ALLImgCheckAnalysisy.cpp index 4a86df5..151daae 100644 --- a/AlgorithmModule/src/ALLImgCheckAnalysisy.cpp +++ b/AlgorithmModule/src/ALLImgCheckAnalysisy.cpp @@ -237,7 +237,7 @@ int ALLImgCheckAnalysisy::InitAIFactory() GPU_Config gpu; gpu.gpu_0 = true; - gpu.gpu_1 = true; + gpu.gpu_1 = false; AI_Factory->InitALLAIModle(gpu); return 0; diff --git a/example/deal.cpp b/example/deal.cpp index 4eb0cf8..e5ca67d 100644 --- a/example/deal.cpp +++ b/example/deal.cpp @@ -1203,7 +1203,12 @@ int deal::DetImg() { m_nReadThread_type = READ_THREAD_TYPE_READIMG; StartThread(THREAD_RUN_Only_ReadImg); - preCheck(); + // -8 循环执行:像 -f 批量一样,线程只启动一次,内部重复跑同一套图 + do + { + preCheck(); + usleep(10 * 1000); + } while (runConfig.bLoop); return 0; } @@ -1633,6 +1638,11 @@ int deal::LoadProductID(std::string strImgPath) } int deal::DelImg_Cell_ET() { + // -8 循环执行:每次重新加载产品列表,重复跑同一批产品 + if (runConfig.bLoop && runConfig.filePath != "") + { + LoadProductID(runConfig.filePath); + } size_t totalSize = m_product_ID_List.size(); if (totalSize > 0) diff --git a/example/deal.h b/example/deal.h index e076902..6294cf7 100644 --- a/example/deal.h +++ b/example/deal.h @@ -499,6 +499,7 @@ struct DealRunConfig RUNTYPE_ det_Type = RUNTYPE_RUN_Pre; // 处理 std::string filePath = ""; // 处理文件路径 如果为空 处理当前的单张图片 bool bSaveProcessImg = false; // 是否中间图片图片 + bool bLoop = false; // -8 循环执行(常驻) void print(std::string str) { printf(">>>>>>>>>>>>>>> %s <<<<<<<<<<<<\n", str.c_str()); diff --git a/example/test_example.cpp b/example/test_example.cpp index 19f6546..d1731ef 100644 --- a/example/test_example.cpp +++ b/example/test_example.cpp @@ -145,12 +145,21 @@ int main(int argc, char *argv[]) test.runConfig.print("config"); // getchar(); signal(SIGINT, handler); - test.start(); - while (true) + // -8: 循环执行程序(常驻);默认:执行一次后退出 + bool bLoop = false; + for (int i = 1; i < argc; i++) { - usleep(10 * 1000); + if (string(argv[i]) == "-8") + { + bLoop = true; + break; + } } + test.runConfig.bLoop = bLoop; + + test.start(); + return 0; }