From 085e06bb875b1337cb0ff4909e508aae1e3f5312 Mon Sep 17 00:00:00 2001 From: liusiyang Date: Tue, 21 Jul 2026 14:28:23 +0800 Subject: [PATCH] =?UTF-8?q?feat=20=E7=A6=BB=E7=BA=BF=E7=A8=8B=E5=BA=8F?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0-tag?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ConfigModule/include/JsonConfig.h | 2 ++ ConfigModule/src/JsonConfig.cpp | 10 ++++++++++ example/deal.cpp | 4 ++++ example/deal.h | 1 + example/test_example.cpp | 7 ++++++- 5 files changed, 23 insertions(+), 1 deletion(-) diff --git a/ConfigModule/include/JsonConfig.h b/ConfigModule/include/JsonConfig.h index 720fb68..4a92689 100644 --- a/ConfigModule/include/JsonConfig.h +++ b/ConfigModule/include/JsonConfig.h @@ -64,6 +64,8 @@ public: int GetConfig(ALLChannelCheckFunction &config); int GetFunction(Json::Value value, CheckFunction &function); + static bool s_bDetTag; // 标签检测模式标志,由命令行 -tag 参数控制 + private: ALLChannelCheckFunction _config; }; diff --git a/ConfigModule/src/JsonConfig.cpp b/ConfigModule/src/JsonConfig.cpp index 40dec9d..ba772e9 100644 --- a/ConfigModule/src/JsonConfig.cpp +++ b/ConfigModule/src/JsonConfig.cpp @@ -1,5 +1,8 @@ #include "JsonConfig.h" +// 静态成员定义:标签检测模式标志 +bool ChannelFuntonConfigJson::s_bDetTag = false; + Json::Value CommonParamJson::toJsonValue() { return Json::Value(); @@ -1128,6 +1131,13 @@ int ChannelFuntonConfigJson::GetFunction(Json::Value value, CheckFunction &funct function.f_Det_BQ.bsaveAll = value_f["form"]["BQ_Param"]["bsaveAll"].asBool(); } } + + // 当 -tag 参数启用时,强制开启标签 AI 检测和保存所有中间结果 + if (s_bDetTag) + { + function.f_Det_BQ.bBQ_AI_Det = true; + function.f_Det_BQ.bsaveAll = true; + } } } } diff --git a/example/deal.cpp b/example/deal.cpp index 688d569..fe433c1 100644 --- a/example/deal.cpp +++ b/example/deal.cpp @@ -8,6 +8,7 @@ #include #include "CheckUtil.hpp" #include "LoadImage.hpp" // #include "LoadImage.h" +#include "JsonConfig.h" bool check_strChannel(string strChannel){ if(strChannel == "XD" || strChannel == "XON") return false; @@ -261,6 +262,9 @@ int deal::Init() // 初始化参数模块 InitConfig(); + // 设置标签检测模式标志,供 ChannelFuntonConfigJson 在解析 JSON 时使用 + ChannelFuntonConfigJson::s_bDetTag = runConfig.det_Tag; + printf("\n\n\n\n\n\n\n\n\n\n\n**********************************************************LoadCheckImgConfig\n"); // 载入参数 re = LoadCheckImgConfig(); diff --git a/example/deal.h b/example/deal.h index b4fe27b..292e4c4 100644 --- a/example/deal.h +++ b/example/deal.h @@ -545,6 +545,7 @@ struct DealRunConfig Process_Run_Type run_Type = Process_Run_Detect; // 运行模式 RUNTYPE_ det_Type = RUNTYPE_RUN_Pre; // 处理 std::string filePath = ""; // 处理文件路径 如果为空 处理当前的单张图片 + bool det_Tag = false; // 是否检测标签 bool bDebugSaveImg = false; // 是否中间图片图片 int m_nTestNum = 999999; void print(std::string str) diff --git a/example/test_example.cpp b/example/test_example.cpp index b11a05c..e1cfad6 100644 --- a/example/test_example.cpp +++ b/example/test_example.cpp @@ -228,7 +228,12 @@ int main(int argc, char *argv[]) return 0; } } - + else if (string(argv[i]) == "-tag" && i + 1 < argc) + { + test.runConfig.det_Type = RUNTYPE_RUN_File; + test.runConfig.filePath = string(argv[i + 1]); + test.runConfig.det_Tag = true; + } if (string(argv[i]) == "-s") { test.runConfig.bDebugSaveImg = true;