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 1dba346..5707929 100644 --- a/AlgorithmModule/src/ALLImgCheckAnalysisy.cpp +++ b/AlgorithmModule/src/ALLImgCheckAnalysisy.cpp @@ -223,7 +223,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; @@ -466,7 +466,8 @@ int ALLImgCheckAnalysisy::InitData() int ALLImgCheckAnalysisy::Det_Product(std::shared_ptr &product) { - + string cur_time_s = CheckUtil::getCurTimeHMS(); + printf("[%s]>>>>>>>>>>>>>>>Det_Product****************det Start************\n", cur_time_s.c_str()); // 处理每个相机 while (true) { @@ -495,8 +496,8 @@ int ALLImgCheckAnalysisy::Det_Product(std::shared_ptr &product) // AnalysiyAll(0); SetProductResult(product); product->SetCheckEnd(); - string cur_time = CheckUtil::getCurTimeHMS(); - printf("[%s]>>>>>>>>>>>>>>>Det_Product****************det End************\n", cur_time.c_str()); + string cur_time_e = CheckUtil::getCurTimeHMS(); + printf("[%s]>>>>>>>>>>>>>>>Det_Product****************det End************\n", cur_time_e.c_str()); return 0; } diff --git a/example/deal.cpp b/example/deal.cpp index 78e2b66..8139592 100644 --- a/example/deal.cpp +++ b/example/deal.cpp @@ -1168,7 +1168,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; } @@ -1598,6 +1603,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 0a3ef64..4b5b8de 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..0cfad56 100644 --- a/example/test_example.cpp +++ b/example/test_example.cpp @@ -85,6 +85,7 @@ int main(int argc, char *argv[]) cout << "*** 5、./test_JBL_Check -falign filepath num : 批量测试定位算法,num 至多处理张数,结果:/home/aidlux/BOE/Align" << endl; cout << "*** 6、./test_JBL_Check -rjson filepath: 单张复测,filepath xx/xx/3A3K380001B1DK_20240408_152157_Main_0_2_L255" << endl; cout << "*** 6、./test_JBL_Check -rjsonall filepath: 一套图复测,filepath xx/xx/" << endl; + cout << "*** 7、./test_SOCKET -8: 循环执行程序(常驻),不加 -8 只执行一次" << endl; cout << "******************************************************" << endl; return 0; @@ -145,12 +146,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; }