提交 d8e3bf71 编写于 作者: S sjtubinlong

inference: fix bugs

上级 bf19cd62
...@@ -125,6 +125,10 @@ namespace PaddleSolution { ...@@ -125,6 +125,10 @@ namespace PaddleSolution {
int Predictor::native_predict(const std::vector<std::string>& imgs) int Predictor::native_predict(const std::vector<std::string>& imgs)
{ {
if (imgs.size() == 0) {
LOG(ERROR) << "No image found";
return -1;
}
int config_batch_size = _model_config._batch_size; int config_batch_size = _model_config._batch_size;
int channels = _model_config._channels; int channels = _model_config._channels;
...@@ -205,6 +209,11 @@ namespace PaddleSolution { ...@@ -205,6 +209,11 @@ namespace PaddleSolution {
int Predictor::analysis_predict(const std::vector<std::string>& imgs) { int Predictor::analysis_predict(const std::vector<std::string>& imgs) {
if (imgs.size() == 0) {
LOG(ERROR) << "No image found";
return -1;
}
int config_batch_size = _model_config._batch_size; int config_batch_size = _model_config._batch_size;
int channels = _model_config._channels; int channels = _model_config._channels;
int eval_width = _model_config._resize[0]; int eval_width = _model_config._resize[0];
......
...@@ -28,7 +28,6 @@ namespace PaddleSolution { ...@@ -28,7 +28,6 @@ namespace PaddleSolution {
_channels = 0; _channels = 0;
_use_gpu = 0; _use_gpu = 0;
_batch_size = 1; _batch_size = 1;
_model_name.clear();
_model_file_name.clear(); _model_file_name.clear();
_model_path.clear(); _model_path.clear();
_param_file_name.clear(); _param_file_name.clear();
......
...@@ -33,13 +33,11 @@ namespace PaddleSolution { ...@@ -33,13 +33,11 @@ namespace PaddleSolution {
} }
while ((entry = readdir(dir)) != NULL) { while ((entry = readdir(dir)) != NULL) {
printf("%s\n", entry->d_name);
std::string item = entry->d_name; std::string item = entry->d_name;
auto ext = strrchr(entry->d_name, '.'); auto ext = strrchr(entry->d_name, '.');
if (!ext || std::string(ext) == "." || std::string(ext) == "..") { if (!ext || std::string(ext) == "." || std::string(ext) == "..") {
continue; continue;
} }
printf("%s\n", entry->d_name);
if (exts.find(ext) != std::string::npos) { if (exts.find(ext) != std::string::npos) {
imgs.push_back(path_join(path, entry->d_name)); imgs.push_back(path_join(path, entry->d_name));
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册