From d8e3bf710cddb14b1cc7daaa68952ecf541905b5 Mon Sep 17 00:00:00 2001 From: sjtubinlong Date: Thu, 29 Aug 2019 22:58:02 +0800 Subject: [PATCH] inference: fix bugs --- inference/predictor/seg_predictor.cpp | 9 +++++++++ inference/utils/seg_conf_parser.h | 1 - inference/utils/utils.h | 2 -- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/inference/predictor/seg_predictor.cpp b/inference/predictor/seg_predictor.cpp index 4b6e44e6..ee32d755 100644 --- a/inference/predictor/seg_predictor.cpp +++ b/inference/predictor/seg_predictor.cpp @@ -125,6 +125,10 @@ namespace PaddleSolution { int Predictor::native_predict(const std::vector& imgs) { + if (imgs.size() == 0) { + LOG(ERROR) << "No image found"; + return -1; + } int config_batch_size = _model_config._batch_size; int channels = _model_config._channels; @@ -205,6 +209,11 @@ namespace PaddleSolution { int Predictor::analysis_predict(const std::vector& imgs) { + if (imgs.size() == 0) { + LOG(ERROR) << "No image found"; + return -1; + } + int config_batch_size = _model_config._batch_size; int channels = _model_config._channels; int eval_width = _model_config._resize[0]; diff --git a/inference/utils/seg_conf_parser.h b/inference/utils/seg_conf_parser.h index d490383d..078d04f3 100644 --- a/inference/utils/seg_conf_parser.h +++ b/inference/utils/seg_conf_parser.h @@ -28,7 +28,6 @@ namespace PaddleSolution { _channels = 0; _use_gpu = 0; _batch_size = 1; - _model_name.clear(); _model_file_name.clear(); _model_path.clear(); _param_file_name.clear(); diff --git a/inference/utils/utils.h b/inference/utils/utils.h index 49ac83b2..e349618a 100644 --- a/inference/utils/utils.h +++ b/inference/utils/utils.h @@ -33,13 +33,11 @@ namespace PaddleSolution { } while ((entry = readdir(dir)) != NULL) { - printf("%s\n", entry->d_name); std::string item = entry->d_name; auto ext = strrchr(entry->d_name, '.'); if (!ext || std::string(ext) == "." || std::string(ext) == "..") { continue; } - printf("%s\n", entry->d_name); if (exts.find(ext) != std::string::npos) { imgs.push_back(path_join(path, entry->d_name)); } -- GitLab