perf: 减少部分日志输出

This commit is contained in:
zzyyyl
2024-07-31 16:55:25 +08:00
parent 792d839dea
commit 13b9afeb2c
4 changed files with 8 additions and 5 deletions

View File

@@ -57,7 +57,7 @@ bool asst::TemplResource::load(const std::filesystem::path& path)
const cv::Mat& asst::TemplResource::get_templ(const std::string& name)
{
if (m_templs.find(name) == m_templs.cend()) {
Log.info(__FUNCTION__, "lazy load", name);
// Log.info(__FUNCTION__, "lazy load", name);
auto path_iter = m_templ_paths.find(name);
if (path_iter == m_templ_paths.cend()) {

View File

@@ -27,11 +27,12 @@ Matcher::ResultOpt Matcher::analyze() const
if (std::isnan(max_val) || std::isinf(max_val)) {
max_val = 0;
}
if (m_log_tracing && max_val > 0.5) { // 得分太低的肯定不对,没必要打印
double threshold = m_params.templ_thres[i];
if (m_log_tracing && max_val > 0.5 && max_val > threshold - 0.2) { // 得分太低的肯定不对,没必要打印
Log.trace("match_templ |", templ_name, "score:", max_val, "rect:", rect, "roi:", m_roi);
}
double threshold = m_params.templ_thres[i];
if (max_val < threshold) {
continue;
}

View File

@@ -25,7 +25,7 @@ PipelineAnalyzer::ResultOpt PipelineAnalyzer::analyze() const
continue;
}
Log.trace(__FUNCTION__, task_ptr->name);
// Log.trace(__FUNCTION__, task_ptr->name);
switch (task_ptr->algorithm) {
case AlgorithmType::JustReturn: {
return Result { .task_ptr = task_ptr };
@@ -33,11 +33,13 @@ PipelineAnalyzer::ResultOpt PipelineAnalyzer::analyze() const
case AlgorithmType::MatchTemplate:
if (auto match_opt = match(task_ptr)) {
Log.trace(__FUNCTION__, "| MatchTemplate", task_ptr->name);
return Result { .task_ptr = task_ptr, .result = *match_opt, .rect = match_opt->rect };
}
break;
case AlgorithmType::OcrDetect:
if (auto ocr_opt = ocr(task_ptr)) {
Log.trace(__FUNCTION__, "| OcrDetect", task_ptr->name, *ocr_opt);
return Result { .task_ptr = task_ptr, .result = ocr_opt->front(), .rect = ocr_opt->front().rect };
}
break;

View File

@@ -40,7 +40,7 @@ OCRer::ResultsVecOpt OCRer::analyze() const
results_vec.emplace_back(std::move(res));
}
Log.trace("Proceed", results_vec);
// Log.trace("Proceed", results_vec);
if (results_vec.empty()) {
return std::nullopt;