提交 764e8982 编写于 作者: F FlyingQianMM

change chinese comments to english comments

上级 ff361bdf
...@@ -51,7 +51,7 @@ int main(int argc, char** argv) { ...@@ -51,7 +51,7 @@ int main(int argc, char** argv) {
return -1; return -1;
} }
// 加载模型 // Load model
PaddleX::Model model; PaddleX::Model model;
model.Init(FLAGS_model_dir, model.Init(FLAGS_model_dir,
FLAGS_use_gpu, FLAGS_use_gpu,
...@@ -59,7 +59,7 @@ int main(int argc, char** argv) { ...@@ -59,7 +59,7 @@ int main(int argc, char** argv) {
FLAGS_gpu_id, FLAGS_gpu_id,
FLAGS_key); FLAGS_key);
// 进行预测 // Predict
int imgs = 1; int imgs = 1;
if (FLAGS_image_list != "") { if (FLAGS_image_list != "") {
std::ifstream inf(FLAGS_image_list); std::ifstream inf(FLAGS_image_list);
...@@ -67,7 +67,7 @@ int main(int argc, char** argv) { ...@@ -67,7 +67,7 @@ int main(int argc, char** argv) {
std::cerr << "Fail to open file " << FLAGS_image_list << std::endl; std::cerr << "Fail to open file " << FLAGS_image_list << std::endl;
return -1; return -1;
} }
// 多batch预测 // Mini-batch predict
std::string image_path; std::string image_path;
std::vector<std::string> image_paths; std::vector<std::string> image_paths;
while (getline(inf, image_path)) { while (getline(inf, image_path)) {
...@@ -75,7 +75,7 @@ int main(int argc, char** argv) { ...@@ -75,7 +75,7 @@ int main(int argc, char** argv) {
} }
imgs = image_paths.size(); imgs = image_paths.size();
for (int i = 0; i < image_paths.size(); i += FLAGS_batch_size) { for (int i = 0; i < image_paths.size(); i += FLAGS_batch_size) {
// 读图像 // Read image
int im_vec_size = int im_vec_size =
std::min(static_cast<int>(image_paths.size()), i + FLAGS_batch_size); std::min(static_cast<int>(image_paths.size()), i + FLAGS_batch_size);
std::vector<cv::Mat> im_vec(im_vec_size - i); std::vector<cv::Mat> im_vec(im_vec_size - i);
......
...@@ -45,7 +45,7 @@ DEFINE_int32(thread_num, ...@@ -45,7 +45,7 @@ DEFINE_int32(thread_num,
"Number of preprocessing threads"); "Number of preprocessing threads");
int main(int argc, char** argv) { int main(int argc, char** argv) {
// 解析命令行参数 // Parsing command-line
google::ParseCommandLineFlags(&argc, &argv, true); google::ParseCommandLineFlags(&argc, &argv, true);
if (FLAGS_model_dir == "") { if (FLAGS_model_dir == "") {
...@@ -56,7 +56,7 @@ int main(int argc, char** argv) { ...@@ -56,7 +56,7 @@ int main(int argc, char** argv) {
std::cerr << "--image or --image_list need to be defined" << std::endl; std::cerr << "--image or --image_list need to be defined" << std::endl;
return -1; return -1;
} }
// 加载模型 // Load model
PaddleX::Model model; PaddleX::Model model;
model.Init(FLAGS_model_dir, model.Init(FLAGS_model_dir,
FLAGS_use_gpu, FLAGS_use_gpu,
...@@ -65,7 +65,7 @@ int main(int argc, char** argv) { ...@@ -65,7 +65,7 @@ int main(int argc, char** argv) {
FLAGS_key); FLAGS_key);
int imgs = 1; int imgs = 1;
std::string save_dir = "output"; std::string save_dir = "output";
// 进行预测 // Predict
if (FLAGS_image_list != "") { if (FLAGS_image_list != "") {
std::ifstream inf(FLAGS_image_list); std::ifstream inf(FLAGS_image_list);
if (!inf) { if (!inf) {
...@@ -90,7 +90,7 @@ int main(int argc, char** argv) { ...@@ -90,7 +90,7 @@ int main(int argc, char** argv) {
im_vec[j - i] = std::move(cv::imread(image_paths[j], 1)); im_vec[j - i] = std::move(cv::imread(image_paths[j], 1));
} }
model.predict(im_vec, &results, thread_num); model.predict(im_vec, &results, thread_num);
// 输出结果目标框 // Output predicted bounding boxes
for (int j = 0; j < im_vec_size - i; ++j) { for (int j = 0; j < im_vec_size - i; ++j) {
for (int k = 0; k < results[j].boxes.size(); ++k) { for (int k = 0; k < results[j].boxes.size(); ++k) {
std::cout << "image file: " << image_paths[i + j] << ", "; std::cout << "image file: " << image_paths[i + j] << ", ";
...@@ -104,7 +104,7 @@ int main(int argc, char** argv) { ...@@ -104,7 +104,7 @@ int main(int argc, char** argv) {
<< results[j].boxes[k].coordinate[3] << ")" << std::endl; << results[j].boxes[k].coordinate[3] << ")" << std::endl;
} }
} }
// 可视化 // Visualize results
for (int j = 0; j < im_vec_size - i; ++j) { for (int j = 0; j < im_vec_size - i; ++j) {
cv::Mat vis_img = PaddleX::Visualize( cv::Mat vis_img = PaddleX::Visualize(
im_vec[j], results[j], model.labels, FLAGS_threshold); im_vec[j], results[j], model.labels, FLAGS_threshold);
...@@ -118,7 +118,7 @@ int main(int argc, char** argv) { ...@@ -118,7 +118,7 @@ int main(int argc, char** argv) {
PaddleX::DetResult result; PaddleX::DetResult result;
cv::Mat im = cv::imread(FLAGS_image, 1); cv::Mat im = cv::imread(FLAGS_image, 1);
model.predict(im, &result); model.predict(im, &result);
// 输出结果目标框 // Output predicted bounding boxes
for (int i = 0; i < result.boxes.size(); ++i) { for (int i = 0; i < result.boxes.size(); ++i) {
std::cout << "image file: " << FLAGS_image << std::endl; std::cout << "image file: " << FLAGS_image << std::endl;
std::cout << ", predict label: " << result.boxes[i].category std::cout << ", predict label: " << result.boxes[i].category
...@@ -130,7 +130,7 @@ int main(int argc, char** argv) { ...@@ -130,7 +130,7 @@ int main(int argc, char** argv) {
<< result.boxes[i].coordinate[3] << ")" << std::endl; << result.boxes[i].coordinate[3] << ")" << std::endl;
} }
// 可视化 // Visualize results
cv::Mat vis_img = cv::Mat vis_img =
PaddleX::Visualize(im, result, model.labels, FLAGS_threshold); PaddleX::Visualize(im, result, model.labels, FLAGS_threshold);
std::string save_path = std::string save_path =
......
...@@ -41,7 +41,7 @@ DEFINE_int32(thread_num, ...@@ -41,7 +41,7 @@ DEFINE_int32(thread_num,
"Number of preprocessing threads"); "Number of preprocessing threads");
int main(int argc, char** argv) { int main(int argc, char** argv) {
// 解析命令行参数 // Parsing command-line
google::ParseCommandLineFlags(&argc, &argv, true); google::ParseCommandLineFlags(&argc, &argv, true);
if (FLAGS_model_dir == "") { if (FLAGS_model_dir == "") {
...@@ -53,7 +53,7 @@ int main(int argc, char** argv) { ...@@ -53,7 +53,7 @@ int main(int argc, char** argv) {
return -1; return -1;
} }
// 加载模型 // Load model
PaddleX::Model model; PaddleX::Model model;
model.Init(FLAGS_model_dir, model.Init(FLAGS_model_dir,
FLAGS_use_gpu, FLAGS_use_gpu,
...@@ -61,7 +61,7 @@ int main(int argc, char** argv) { ...@@ -61,7 +61,7 @@ int main(int argc, char** argv) {
FLAGS_gpu_id, FLAGS_gpu_id,
FLAGS_key); FLAGS_key);
int imgs = 1; int imgs = 1;
// 进行预测 // Predict
if (FLAGS_image_list != "") { if (FLAGS_image_list != "") {
std::ifstream inf(FLAGS_image_list); std::ifstream inf(FLAGS_image_list);
if (!inf) { if (!inf) {
...@@ -86,7 +86,7 @@ int main(int argc, char** argv) { ...@@ -86,7 +86,7 @@ int main(int argc, char** argv) {
im_vec[j - i] = std::move(cv::imread(image_paths[j], 1)); im_vec[j - i] = std::move(cv::imread(image_paths[j], 1));
} }
model.predict(im_vec, &results, thread_num); model.predict(im_vec, &results, thread_num);
// 可视化 // Visualize results
for (int j = 0; j < im_vec_size - i; ++j) { for (int j = 0; j < im_vec_size - i; ++j) {
cv::Mat vis_img = cv::Mat vis_img =
PaddleX::Visualize(im_vec[j], results[j], model.labels); PaddleX::Visualize(im_vec[j], results[j], model.labels);
...@@ -100,7 +100,7 @@ int main(int argc, char** argv) { ...@@ -100,7 +100,7 @@ int main(int argc, char** argv) {
PaddleX::SegResult result; PaddleX::SegResult result;
cv::Mat im = cv::imread(FLAGS_image, 1); cv::Mat im = cv::imread(FLAGS_image, 1);
model.predict(im, &result); model.predict(im, &result);
// 可视化 // Visualize results
cv::Mat vis_img = PaddleX::Visualize(im, result, model.labels); cv::Mat vis_img = PaddleX::Visualize(im, result, model.labels);
std::string save_path = std::string save_path =
PaddleX::generate_save_path(FLAGS_save_dir, FLAGS_image); PaddleX::generate_save_path(FLAGS_save_dir, FLAGS_image);
......
...@@ -57,7 +57,7 @@ int main(int argc, char** argv) { ...@@ -57,7 +57,7 @@ int main(int argc, char** argv) {
return -1; return -1;
} }
// 加载模型 // Load model
PaddleX::Model model; PaddleX::Model model;
model.Init(FLAGS_model_dir, model.Init(FLAGS_model_dir,
FLAGS_use_gpu, FLAGS_use_gpu,
...@@ -65,7 +65,7 @@ int main(int argc, char** argv) { ...@@ -65,7 +65,7 @@ int main(int argc, char** argv) {
FLAGS_gpu_id, FLAGS_gpu_id,
FLAGS_key); FLAGS_key);
// 打开视频流 // Open video
cv::VideoCapture capture; cv::VideoCapture capture;
if (FLAGS_use_camera) { if (FLAGS_use_camera) {
capture.open(FLAGS_camera_id); capture.open(FLAGS_camera_id);
...@@ -85,11 +85,11 @@ int main(int argc, char** argv) { ...@@ -85,11 +85,11 @@ int main(int argc, char** argv) {
} }
} }
// 创建VideoWriter // Create a VideoWriter
cv::VideoWriter video_out; cv::VideoWriter video_out;
std::string video_out_path; std::string video_out_path;
if (FLAGS_save_result) { if (FLAGS_save_result) {
// 获取视频流信息: 分辨率, 帧率 // Get video information: resolution, fps
int video_width = static_cast<int>(capture.get(CV_CAP_PROP_FRAME_WIDTH)); int video_width = static_cast<int>(capture.get(CV_CAP_PROP_FRAME_WIDTH));
int video_height = static_cast<int>(capture.get(CV_CAP_PROP_FRAME_HEIGHT)); int video_height = static_cast<int>(capture.get(CV_CAP_PROP_FRAME_HEIGHT));
int video_fps = static_cast<int>(capture.get(CV_CAP_PROP_FPS)); int video_fps = static_cast<int>(capture.get(CV_CAP_PROP_FPS));
...@@ -126,16 +126,16 @@ int main(int argc, char** argv) { ...@@ -126,16 +126,16 @@ int main(int argc, char** argv) {
while (capture.read(frame)) { while (capture.read(frame)) {
if (FLAGS_show_result || FLAGS_use_camera) { if (FLAGS_show_result || FLAGS_use_camera) {
key = cv::waitKey(1); key = cv::waitKey(1);
// 按下ESC退出整个程序,保存视频文件到磁盘 // When pressing `ESC`, then exit program and result video is saved
if (key == 27) { if (key == 27) {
break; break;
} }
} else if (frame.empty()) { } else if (frame.empty()) {
break; break;
} }
// 开始预测 // Begin to predict
model.predict(frame, &result); model.predict(frame, &result);
// 可视化 // Visualize results
cv::Mat vis_img = frame.clone(); cv::Mat vis_img = frame.clone();
auto colormap = PaddleX::GenerateColorMap(model.labels.size()); auto colormap = PaddleX::GenerateColorMap(model.labels.size());
int c1 = colormap[3 * result.category_id + 0]; int c1 = colormap[3 * result.category_id + 0];
......
...@@ -48,7 +48,7 @@ DEFINE_double(threshold, ...@@ -48,7 +48,7 @@ DEFINE_double(threshold,
"The minimum scores of target boxes which are shown"); "The minimum scores of target boxes which are shown");
int main(int argc, char** argv) { int main(int argc, char** argv) {
// 解析命令行参数 // Parsing command-line
google::ParseCommandLineFlags(&argc, &argv, true); google::ParseCommandLineFlags(&argc, &argv, true);
if (FLAGS_model_dir == "") { if (FLAGS_model_dir == "") {
...@@ -59,14 +59,14 @@ int main(int argc, char** argv) { ...@@ -59,14 +59,14 @@ int main(int argc, char** argv) {
std::cerr << "--video_path or --use_camera need to be defined" << std::endl; std::cerr << "--video_path or --use_camera need to be defined" << std::endl;
return -1; return -1;
} }
// 加载模型 // Load model
PaddleX::Model model; PaddleX::Model model;
model.Init(FLAGS_model_dir, model.Init(FLAGS_model_dir,
FLAGS_use_gpu, FLAGS_use_gpu,
FLAGS_use_trt, FLAGS_use_trt,
FLAGS_gpu_id, FLAGS_gpu_id,
FLAGS_key); FLAGS_key);
// 打开视频流 // Open video
cv::VideoCapture capture; cv::VideoCapture capture;
if (FLAGS_use_camera) { if (FLAGS_use_camera) {
capture.open(FLAGS_camera_id); capture.open(FLAGS_camera_id);
...@@ -86,11 +86,11 @@ int main(int argc, char** argv) { ...@@ -86,11 +86,11 @@ int main(int argc, char** argv) {
} }
} }
// 创建VideoWriter // Create a VideoWriter
cv::VideoWriter video_out; cv::VideoWriter video_out;
std::string video_out_path; std::string video_out_path;
if (FLAGS_save_result) { if (FLAGS_save_result) {
// 获取视频流信息: 分辨率, 帧率 // Get video information: resolution, fps
int video_width = static_cast<int>(capture.get(CV_CAP_PROP_FRAME_WIDTH)); int video_width = static_cast<int>(capture.get(CV_CAP_PROP_FRAME_WIDTH));
int video_height = static_cast<int>(capture.get(CV_CAP_PROP_FRAME_HEIGHT)); int video_height = static_cast<int>(capture.get(CV_CAP_PROP_FRAME_HEIGHT));
int video_fps = static_cast<int>(capture.get(CV_CAP_PROP_FPS)); int video_fps = static_cast<int>(capture.get(CV_CAP_PROP_FPS));
...@@ -127,15 +127,16 @@ int main(int argc, char** argv) { ...@@ -127,15 +127,16 @@ int main(int argc, char** argv) {
while (capture.read(frame)) { while (capture.read(frame)) {
if (FLAGS_show_result || FLAGS_use_camera) { if (FLAGS_show_result || FLAGS_use_camera) {
key = cv::waitKey(1); key = cv::waitKey(1);
// 按下ESC退出整个程序,保存视频文件到磁盘 // When pressing `ESC`, then exit program and result video is saved
if (key == 27) { if (key == 27) {
break; break;
} }
} else if (frame.empty()) { } else if (frame.empty()) {
break; break;
} }
// Begin to predict
model.predict(frame, &result); model.predict(frame, &result);
// 可视化 // Visualize results
cv::Mat vis_img = cv::Mat vis_img =
PaddleX::Visualize(frame, result, model.labels, FLAGS_threshold); PaddleX::Visualize(frame, result, model.labels, FLAGS_threshold);
if (FLAGS_show_result || FLAGS_use_camera) { if (FLAGS_show_result || FLAGS_use_camera) {
......
...@@ -45,7 +45,7 @@ DEFINE_bool(save_result, true, "save the result of each frame to a video"); ...@@ -45,7 +45,7 @@ DEFINE_bool(save_result, true, "save the result of each frame to a video");
DEFINE_string(save_dir, "output", "Path to save visualized image"); DEFINE_string(save_dir, "output", "Path to save visualized image");
int main(int argc, char** argv) { int main(int argc, char** argv) {
// 解析命令行参数 // Parsing command-line
google::ParseCommandLineFlags(&argc, &argv, true); google::ParseCommandLineFlags(&argc, &argv, true);
if (FLAGS_model_dir == "") { if (FLAGS_model_dir == "") {
...@@ -57,14 +57,14 @@ int main(int argc, char** argv) { ...@@ -57,14 +57,14 @@ int main(int argc, char** argv) {
return -1; return -1;
} }
// 加载模型 // Load model
PaddleX::Model model; PaddleX::Model model;
model.Init(FLAGS_model_dir, model.Init(FLAGS_model_dir,
FLAGS_use_gpu, FLAGS_use_gpu,
FLAGS_use_trt, FLAGS_use_trt,
FLAGS_gpu_id, FLAGS_gpu_id,
FLAGS_key); FLAGS_key);
// 打开视频流 // Open video
cv::VideoCapture capture; cv::VideoCapture capture;
if (FLAGS_use_camera) { if (FLAGS_use_camera) {
capture.open(FLAGS_camera_id); capture.open(FLAGS_camera_id);
...@@ -85,11 +85,11 @@ int main(int argc, char** argv) { ...@@ -85,11 +85,11 @@ int main(int argc, char** argv) {
} }
// 创建VideoWriter // Create a VideoWriter
cv::VideoWriter video_out; cv::VideoWriter video_out;
std::string video_out_path; std::string video_out_path;
if (FLAGS_save_result) { if (FLAGS_save_result) {
// 获取视频流信息: 分辨率, 帧率 // Get video information: resolution, fps
int video_width = static_cast<int>(capture.get(CV_CAP_PROP_FRAME_WIDTH)); int video_width = static_cast<int>(capture.get(CV_CAP_PROP_FRAME_WIDTH));
int video_height = static_cast<int>(capture.get(CV_CAP_PROP_FRAME_HEIGHT)); int video_height = static_cast<int>(capture.get(CV_CAP_PROP_FRAME_HEIGHT));
int video_fps = static_cast<int>(capture.get(CV_CAP_PROP_FPS)); int video_fps = static_cast<int>(capture.get(CV_CAP_PROP_FPS));
...@@ -126,16 +126,16 @@ int main(int argc, char** argv) { ...@@ -126,16 +126,16 @@ int main(int argc, char** argv) {
while (capture.read(frame)) { while (capture.read(frame)) {
if (FLAGS_show_result || FLAGS_use_camera) { if (FLAGS_show_result || FLAGS_use_camera) {
key = cv::waitKey(1); key = cv::waitKey(1);
// 按下ESC退出整个程序,保存视频文件到磁盘 // When pressing `ESC`, then exit program and result video is saved
if (key == 27) { if (key == 27) {
break; break;
} }
} else if (frame.empty()) { } else if (frame.empty()) {
break; break;
} }
// 开始预测 // Begin to predict
model.predict(frame, &result); model.predict(frame, &result);
// 可视化 // Visualize results
cv::Mat vis_img = PaddleX::Visualize(frame, result, model.labels); cv::Mat vis_img = PaddleX::Visualize(frame, result, model.labels);
if (FLAGS_show_result || FLAGS_use_camera) { if (FLAGS_show_result || FLAGS_use_camera) {
cv::imshow("video_segmenter", vis_img); cv::imshow("video_segmenter", vis_img);
......
...@@ -46,7 +46,7 @@ DEFINE_bool(save_result, true, "save the result of each frame to a video"); ...@@ -46,7 +46,7 @@ DEFINE_bool(save_result, true, "save the result of each frame to a video");
DEFINE_string(save_dir, "output", "Path to save visualized image"); DEFINE_string(save_dir, "output", "Path to save visualized image");
int main(int argc, char** argv) { int main(int argc, char** argv) {
// 解析命令行参数 // Parsing command-line
google::ParseCommandLineFlags(&argc, &argv, true); google::ParseCommandLineFlags(&argc, &argv, true);
if (FLAGS_model_dir == "") { if (FLAGS_model_dir == "") {
...@@ -60,7 +60,7 @@ int main(int argc, char** argv) { ...@@ -60,7 +60,7 @@ int main(int argc, char** argv) {
return -1; return -1;
} }
// 加载模型 // Load model
PaddleX::Model model; PaddleX::Model model;
model.Init(FLAGS_model_dir, model.Init(FLAGS_model_dir,
FLAGS_use_gpu, FLAGS_use_gpu,
...@@ -68,7 +68,7 @@ int main(int argc, char** argv) { ...@@ -68,7 +68,7 @@ int main(int argc, char** argv) {
FLAGS_gpu_id, FLAGS_gpu_id,
FLAGS_key); FLAGS_key);
if (FLAGS_use_camera || FLAGS_video_path != "") { if (FLAGS_use_camera || FLAGS_video_path != "") {
// 打开视频流 // Open video
cv::VideoCapture capture; cv::VideoCapture capture;
if (FLAGS_use_camera) { if (FLAGS_use_camera) {
capture.open(FLAGS_camera_id); capture.open(FLAGS_camera_id);
...@@ -88,11 +88,11 @@ int main(int argc, char** argv) { ...@@ -88,11 +88,11 @@ int main(int argc, char** argv) {
} }
} }
// 创建VideoWriter // Create a VideoWriter
cv::VideoWriter video_out; cv::VideoWriter video_out;
std::string video_out_path; std::string video_out_path;
if (FLAGS_save_result) { if (FLAGS_save_result) {
// 获取视频流信息: 分辨率, 帧率 // Get video information: resolution, fps
int video_width = static_cast<int>(capture.get(CV_CAP_PROP_FRAME_WIDTH)); int video_width = static_cast<int>(capture.get(CV_CAP_PROP_FRAME_WIDTH));
int video_height = int video_height =
static_cast<int>(capture.get(CV_CAP_PROP_FRAME_HEIGHT)); static_cast<int>(capture.get(CV_CAP_PROP_FRAME_HEIGHT));
...@@ -129,16 +129,16 @@ int main(int argc, char** argv) { ...@@ -129,16 +129,16 @@ int main(int argc, char** argv) {
while (capture.read(frame)) { while (capture.read(frame)) {
if (FLAGS_show_result || FLAGS_use_camera) { if (FLAGS_show_result || FLAGS_use_camera) {
key = cv::waitKey(1); key = cv::waitKey(1);
// 按下ESC退出整个程序,保存视频文件到磁盘 // When pressing `ESC`, then exit program and result video is saved
if (key == 27) { if (key == 27) {
break; break;
} }
} else if (frame.empty()) { } else if (frame.empty()) {
break; break;
} }
// 开始预测 // Begin to predict
model.predict(frame, &result); model.predict(frame, &result);
// 可视化 // Visualize results
std::vector<uint8_t> label_map(result.label_map.data.begin(), std::vector<uint8_t> label_map(result.label_map.data.begin(),
result.label_map.data.end()); result.label_map.data.end());
cv::Mat mask(result.label_map.shape[0], cv::Mat mask(result.label_map.shape[0],
...@@ -178,7 +178,7 @@ int main(int argc, char** argv) { ...@@ -178,7 +178,7 @@ int main(int argc, char** argv) {
PaddleX::SegResult result; PaddleX::SegResult result;
cv::Mat im = cv::imread(FLAGS_image, 1); cv::Mat im = cv::imread(FLAGS_image, 1);
model.predict(im, &result); model.predict(im, &result);
// 可视化 // Visualize results
std::vector<uint8_t> label_map(result.label_map.data.begin(), std::vector<uint8_t> label_map(result.label_map.data.begin(),
result.label_map.data.end()); result.label_map.data.end());
cv::Mat mask(result.label_map.shape[0], cv::Mat mask(result.label_map.shape[0],
......
...@@ -51,7 +51,8 @@ DEFINE_string(seg_key, "", "Segmenter model key of encryption"); ...@@ -51,7 +51,8 @@ DEFINE_string(seg_key, "", "Segmenter model key of encryption");
DEFINE_string(image, "", "Path of test image file"); DEFINE_string(image, "", "Path of test image file");
DEFINE_string(image_list, "", "Path of test image list file"); DEFINE_string(image_list, "", "Path of test image list file");
DEFINE_string(save_dir, "output", "Path to save visualized image"); DEFINE_string(save_dir, "output", "Path to save visualized image");
DEFINE_double(score_threshold, 0.5, "Detected bbox whose score is lower than this threshlod is filtered"); DEFINE_double(score_threshold, 0.5,
"Detected bbox whose score is lower than this threshlod is filtered");
void predict(const cv::Mat &input_image, PaddleX::Model *det_model, void predict(const cv::Mat &input_image, PaddleX::Model *det_model,
PaddleX::Model *seg_model, const std::string save_dir, PaddleX::Model *seg_model, const std::string save_dir,
...@@ -207,7 +208,7 @@ int main(int argc, char **argv) { ...@@ -207,7 +208,7 @@ int main(int argc, char **argv) {
return -1; return -1;
} }
// 加载模型 // Load model
PaddleX::Model det_model; PaddleX::Model det_model;
det_model.Init(FLAGS_det_model_dir, FLAGS_use_gpu, FLAGS_use_trt, det_model.Init(FLAGS_det_model_dir, FLAGS_use_gpu, FLAGS_use_trt,
FLAGS_gpu_id, FLAGS_det_key); FLAGS_gpu_id, FLAGS_det_key);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册