提交 7a178866 编写于 作者: S syyxsxx

change cfg_dir to cfg_file

上级 d1866a90
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#include "include/paddlex/paddlex.h" #include "include/paddlex/paddlex.h"
DEFINE_string(model_dir, "", "Path of inference model"); DEFINE_string(model_dir, "", "Path of inference model");
DEFINE_string(cfg_dir, "", "Path of PaddelX model yml file"); DEFINE_string(cfg_file, "", "Path of PaddelX model yml file");
DEFINE_string(device, "CPU", "Device name"); DEFINE_string(device, "CPU", "Device name");
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");
...@@ -35,8 +35,8 @@ int main(int argc, char** argv) { ...@@ -35,8 +35,8 @@ int main(int argc, char** argv) {
std::cerr << "--model_dir need to be defined" << std::endl; std::cerr << "--model_dir need to be defined" << std::endl;
return -1; return -1;
} }
if (FLAGS_cfg_dir == "") { if (FLAGS_cfg_file == "") {
std::cerr << "--cfg_dir need to be defined" << std::endl; std::cerr << "--cfg_file need to be defined" << std::endl;
return -1; return -1;
} }
if (FLAGS_image == "" & FLAGS_image_list == "") { if (FLAGS_image == "" & FLAGS_image_list == "") {
...@@ -46,7 +46,7 @@ int main(int argc, char** argv) { ...@@ -46,7 +46,7 @@ int main(int argc, char** argv) {
// 加载模型 // 加载模型
PaddleX::Model model; PaddleX::Model model;
model.Init(FLAGS_model_dir, FLAGS_cfg_dir, FLAGS_device); model.Init(FLAGS_model_dir, FLAGS_cfg_file, FLAGS_device);
// 进行预测 // 进行预测
if (FLAGS_image_list != "") { if (FLAGS_image_list != "") {
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
using namespace std::chrono; // NOLINT using namespace std::chrono; // NOLINT
DEFINE_string(model_dir, "", "Path of openvino model xml file"); DEFINE_string(model_dir, "", "Path of openvino model xml file");
DEFINE_string(cfg_dir, "", "Path of PaddleX model yaml file"); DEFINE_string(cfg_file, "", "Path of PaddleX model yaml file");
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(device, "CPU", "Device name"); DEFINE_string(device, "CPU", "Device name");
...@@ -45,8 +45,8 @@ int main(int argc, char** argv) { ...@@ -45,8 +45,8 @@ int main(int argc, char** argv) {
std::cerr << "--model_dir need to be defined" << std::endl; std::cerr << "--model_dir need to be defined" << std::endl;
return -1; return -1;
} }
if (FLAGS_cfg_dir == "") { if (FLAGS_cfg_file == "") {
std::cerr << "--cfg_dir need to be defined" << std::endl; std::cerr << "--cfg_file need to be defined" << std::endl;
return -1; return -1;
} }
if (FLAGS_image == "" & FLAGS_image_list == "") { if (FLAGS_image == "" & FLAGS_image_list == "") {
...@@ -56,7 +56,7 @@ int main(int argc, char** argv) { ...@@ -56,7 +56,7 @@ int main(int argc, char** argv) {
// //
PaddleX::Model model; PaddleX::Model model;
model.Init(FLAGS_model_dir, FLAGS_cfg_dir, FLAGS_device); model.Init(FLAGS_model_dir, FLAGS_cfg_file, FLAGS_device);
int imgs = 1; int imgs = 1;
auto colormap = PaddleX::GenerateColorMap(model.labels.size()); auto colormap = PaddleX::GenerateColorMap(model.labels.size());
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
DEFINE_string(model_dir, "", "Path of openvino model xml file"); DEFINE_string(model_dir, "", "Path of openvino model xml file");
DEFINE_string(cfg_dir, "", "Path of PaddleX model yaml file"); DEFINE_string(cfg_file, "", "Path of PaddleX model yaml file");
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(device, "CPU", "Device name"); DEFINE_string(device, "CPU", "Device name");
...@@ -39,8 +39,8 @@ int main(int argc, char** argv) { ...@@ -39,8 +39,8 @@ int main(int argc, char** argv) {
std::cerr << "--model_dir need to be defined" << std::endl; std::cerr << "--model_dir need to be defined" << std::endl;
return -1; return -1;
} }
if (FLAGS_cfg_dir == "") { if (FLAGS_cfg_file == "") {
std::cerr << "--cfg_dir need to be defined" << std::endl; std::cerr << "--cfg_file need to be defined" << std::endl;
return -1; return -1;
} }
if (FLAGS_image == "" & FLAGS_image_list == "") { if (FLAGS_image == "" & FLAGS_image_list == "") {
...@@ -51,7 +51,7 @@ int main(int argc, char** argv) { ...@@ -51,7 +51,7 @@ int main(int argc, char** argv) {
// //
std::cout << "init start" << std::endl; std::cout << "init start" << std::endl;
PaddleX::Model model; PaddleX::Model model;
model.Init(FLAGS_model_dir, FLAGS_cfg_dir, FLAGS_device); model.Init(FLAGS_model_dir, FLAGS_cfg_file, FLAGS_device);
std::cout << "init done" << std::endl; std::cout << "init done" << std::endl;
int imgs = 1; int imgs = 1;
auto colormap = PaddleX::GenerateColorMap(model.labels.size()); auto colormap = PaddleX::GenerateColorMap(model.labels.size());
......
...@@ -39,13 +39,13 @@ namespace PaddleX { ...@@ -39,13 +39,13 @@ namespace PaddleX {
class Model { class Model {
public: public:
void Init(const std::string& model_dir, void Init(const std::string& model_dir,
const std::string& cfg_dir, const std::string& cfg_file,
std::string device) { std::string device) {
create_predictor(model_dir, cfg_dir, device); create_predictor(model_dir, cfg_file, device);
} }
void create_predictor(const std::string& model_dir, void create_predictor(const std::string& model_dir,
const std::string& cfg_dir, const std::string& cfg_file,
std::string device); std::string device);
bool load_config(const std::string& model_dir); bool load_config(const std::string& model_dir);
......
...@@ -34,28 +34,18 @@ def arg_parser(): ...@@ -34,28 +34,18 @@ def arg_parser():
help="Specify the target device to infer on:[CPU, GPU, FPGA, HDDL, MYRIAD,HETERO]" help="Specify the target device to infer on:[CPU, GPU, FPGA, HDDL, MYRIAD,HETERO]"
"Default value is CPU") "Default value is CPU")
parser.add_argument( parser.add_argument(
"--img", "--img", "-i", type=str, default=None, help="path to an image files")
"-i",
type=str,
default=None,
help="path to an image files")
parser.add_argument( parser.add_argument(
"--img_list", "--img_list", "-l", type=str, default=None, help="Path to a imglist")
"-l",
type=str,
default=None,
help="Path to a imglist")
parser.add_argument( parser.add_argument(
"--cfg_dir", "--cfg_file",
"-c", "-c",
type=str, type=str,
default=None, default=None,
help="Path to PaddelX model yml file") help="Path to PaddelX model yml file")
return parser return parser
...@@ -63,16 +53,16 @@ def main(): ...@@ -63,16 +53,16 @@ def main():
parser = arg_parser() parser = arg_parser()
args = parser.parse_args() args = parser.parse_args()
model_xml = args.model_dir model_xml = args.model_dir
model_yaml = args.cfg_dir model_yaml = args.cfg_file
#model init #model init
if("CPU" not in args.device): if ("CPU" not in args.device):
predictor = deploy.Predictor(model_xml,model_yaml,args.device) predictor = deploy.Predictor(model_xml, model_yaml, args.device)
else: else:
predictor = deploy.Predictor(model_xml,model_yaml) predictor = deploy.Predictor(model_xml, model_yaml)
#predict #predict
if(args.img_list != None): if (args.img_list != None):
f = open(args.img_list) f = open(args.img_list)
lines = f.readlines() lines = f.readlines()
for im_path in lines: for im_path in lines:
...@@ -83,5 +73,6 @@ def main(): ...@@ -83,5 +73,6 @@ def main():
im_path = args.img im_path = args.img
predictor.predict(im_path) predictor.predict(im_path)
if __name__ == "__main__": if __name__ == "__main__":
main() main()
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
namespace PaddleX { namespace PaddleX {
void Model::create_predictor(const std::string& model_dir, void Model::create_predictor(const std::string& model_dir,
const std::string& cfg_dir, const std::string& cfg_file,
std::string device) { std::string device) {
InferenceEngine::Core ie; InferenceEngine::Core ie;
network_ = ie.ReadNetwork( network_ = ie.ReadNetwork(
...@@ -49,11 +49,11 @@ void Model::create_predictor(const std::string& model_dir, ...@@ -49,11 +49,11 @@ void Model::create_predictor(const std::string& model_dir,
} else { } else {
executable_network_ = ie.LoadNetwork(network_, device); executable_network_ = ie.LoadNetwork(network_, device);
} }
load_config(cfg_dir); load_config(cfg_file);
} }
bool Model::load_config(const std::string& cfg_dir) { bool Model::load_config(const std::string& cfg_file) {
YAML::Node config = YAML::LoadFile(cfg_dir); YAML::Node config = YAML::LoadFile(cfg_file);
type = config["_Attributes"]["model_type"].as<std::string>(); type = config["_Attributes"]["model_type"].as<std::string>();
name = config["Model"].as<std::string>(); name = config["Model"].as<std::string>();
bool to_rgb = true; bool to_rgb = true;
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#include "include/paddlex/paddlex.h" #include "include/paddlex/paddlex.h"
DEFINE_string(model_dir, "", "Path of inference model"); DEFINE_string(model_dir, "", "Path of inference model");
DEFINE_string(cfg_dir, "", "Path of PaddelX model yml file"); DEFINE_string(cfg_file, "", "Path of PaddelX model yml file");
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_int32(thread_num, 1, "num of thread to infer"); DEFINE_int32(thread_num, 1, "num of thread to infer");
...@@ -35,8 +35,8 @@ int main(int argc, char** argv) { ...@@ -35,8 +35,8 @@ int main(int argc, char** argv) {
std::cerr << "--model_dir need to be defined" << std::endl; std::cerr << "--model_dir need to be defined" << std::endl;
return -1; return -1;
} }
if (FLAGS_cfg_dir == "") { if (FLAGS_cfg_file == "") {
std::cerr << "--cfg_dir need to be defined" << std::endl; std::cerr << "--cfg_flie need to be defined" << std::endl;
return -1; return -1;
} }
if (FLAGS_image == "" & FLAGS_image_list == "") { if (FLAGS_image == "" & FLAGS_image_list == "") {
...@@ -46,7 +46,7 @@ int main(int argc, char** argv) { ...@@ -46,7 +46,7 @@ int main(int argc, char** argv) {
// 加载模型 // 加载模型
PaddleX::Model model; PaddleX::Model model;
model.Init(FLAGS_model_dir, FLAGS_cfg_dir, FLAGS_thread_num); model.Init(FLAGS_model_dir, FLAGS_cfg_file, FLAGS_thread_num);
std::cout << "init is done" << std::endl; std::cout << "init is done" << std::endl;
// 进行预测 // 进行预测
if (FLAGS_image_list != "") { if (FLAGS_image_list != "") {
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
using namespace std::chrono; // NOLINT using namespace std::chrono; // NOLINT
DEFINE_string(model_dir, "", "Path of openvino model xml file"); DEFINE_string(model_dir, "", "Path of openvino model xml file");
DEFINE_string(cfg_dir, "", "Path of PaddleX model yaml file"); DEFINE_string(cfg_file, "", "Path of PaddleX model yaml file");
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_int32(thread_num, 1, "num of thread to infer"); DEFINE_int32(thread_num, 1, "num of thread to infer");
...@@ -45,8 +45,8 @@ int main(int argc, char** argv) { ...@@ -45,8 +45,8 @@ int main(int argc, char** argv) {
std::cerr << "--model_dir need to be defined" << std::endl; std::cerr << "--model_dir need to be defined" << std::endl;
return -1; return -1;
} }
if (FLAGS_cfg_dir == "") { if (FLAGS_cfg_file == "") {
std::cerr << "--cfg_dir need to be defined" << std::endl; std::cerr << "--cfg_file need to be defined" << std::endl;
return -1; return -1;
} }
if (FLAGS_image == "" & FLAGS_image_list == "") { if (FLAGS_image == "" & FLAGS_image_list == "") {
...@@ -56,7 +56,7 @@ int main(int argc, char** argv) { ...@@ -56,7 +56,7 @@ int main(int argc, char** argv) {
// //
PaddleX::Model model; PaddleX::Model model;
model.Init(FLAGS_model_dir, FLAGS_cfg_dir, FLAGS_thread_num); model.Init(FLAGS_model_dir, FLAGS_cfg_file, FLAGS_thread_num);
int imgs = 1; int imgs = 1;
auto colormap = PaddleX::GenerateColorMap(model.labels.size()); auto colormap = PaddleX::GenerateColorMap(model.labels.size());
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
DEFINE_string(model_dir, "", "Path of openvino model xml file"); DEFINE_string(model_dir, "", "Path of openvino model xml file");
DEFINE_string(cfg_dir, "", "Path of PaddleX model yaml file"); DEFINE_string(cfg_file, "", "Path of PaddleX model yaml file");
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, "", "Path to save visualized image"); DEFINE_string(save_dir, "", "Path to save visualized image");
...@@ -38,8 +38,8 @@ int main(int argc, char** argv) { ...@@ -38,8 +38,8 @@ int main(int argc, char** argv) {
std::cerr << "--model_dir need to be defined" << std::endl; std::cerr << "--model_dir need to be defined" << std::endl;
return -1; return -1;
} }
if (FLAGS_cfg_dir == "") { if (FLAGS_cfg_file == "") {
std::cerr << "--cfg_dir need to be defined" << std::endl; std::cerr << "--cfg_file need to be defined" << std::endl;
return -1; return -1;
} }
if (FLAGS_image == "" & FLAGS_image_list == "") { if (FLAGS_image == "" & FLAGS_image_list == "") {
...@@ -50,7 +50,7 @@ int main(int argc, char** argv) { ...@@ -50,7 +50,7 @@ int main(int argc, char** argv) {
// //
std::cout << "init start" << std::endl; std::cout << "init start" << std::endl;
PaddleX::Model model; PaddleX::Model model;
model.Init(FLAGS_model_dir, FLAGS_cfg_dir, FLAGS_thread_num); model.Init(FLAGS_model_dir, FLAGS_cfg_file, FLAGS_thread_num);
std::cout << "init done" << std::endl; std::cout << "init done" << std::endl;
int imgs = 1; int imgs = 1;
auto colormap = PaddleX::GenerateColorMap(model.labels.size()); auto colormap = PaddleX::GenerateColorMap(model.labels.size());
......
...@@ -49,13 +49,13 @@ namespace PaddleX { ...@@ -49,13 +49,13 @@ namespace PaddleX {
class Model { class Model {
public: public:
void Init(const std::string& model_dir, void Init(const std::string& model_dir,
const std::string& cfg_dir, const std::string& cfg_file,
int thread_num) { int thread_num) {
create_predictor(model_dir, cfg_dir, thread_num); create_predictor(model_dir, cfg_file, thread_num);
} }
void create_predictor(const std::string& model_dir, void create_predictor(const std::string& model_dir,
const std::string& cfg_dir, const std::string& cfg_file,
int thread_num); int thread_num);
bool load_config(const std::string& model_dir); bool load_config(const std::string& model_dir);
......
...@@ -27,28 +27,18 @@ def arg_parser(): ...@@ -27,28 +27,18 @@ def arg_parser():
default=None, default=None,
help="path to openvino model .xml file") help="path to openvino model .xml file")
parser.add_argument( parser.add_argument(
"--img", "--img", "-i", type=str, default=None, help="path to an image files")
"-i",
type=str,
default=None,
help="path to an image files")
parser.add_argument( parser.add_argument(
"--img_list", "--img_list", "-l", type=str, default=None, help="Path to a imglist")
"-l",
type=str,
default=None,
help="Path to a imglist")
parser.add_argument( parser.add_argument(
"--cfg_dir", "--cfg_file",
"-c", "-c",
type=str, type=str,
default=None, default=None,
help="Path to PaddelX model yml file") help="Path to PaddelX model yml file")
parser.add_argument( parser.add_argument(
"--thread_num", "--thread_num",
"-t", "-t",
...@@ -63,8 +53,6 @@ def arg_parser(): ...@@ -63,8 +53,6 @@ def arg_parser():
default=None, default=None,
help=" image input shape of model [NCHW] like [1,3,224,244] ") help=" image input shape of model [NCHW] like [1,3,224,244] ")
return parser return parser
...@@ -72,16 +60,16 @@ def main(): ...@@ -72,16 +60,16 @@ def main():
parser = arg_parser() parser = arg_parser()
args = parser.parse_args() args = parser.parse_args()
model_nb = args.model_dir model_nb = args.model_dir
model_yaml = args.cfg_dir model_yaml = args.cfg_file
thread_num = args.thread_num thread_num = args.thread_num
input_shape = args.input_shape input_shape = args.input_shape
input_shape = input_shape[1:-1].split(",",3) input_shape = input_shape[1:-1].split(",", 3)
shape = list(map(int,input_shape)) shape = list(map(int, input_shape))
#model init #model init
predictor = deploy.Predictor(model_nb,model_yaml,thread_num,shape) predictor = deploy.Predictor(model_nb, model_yaml, thread_num, shape)
#predict #predict
if(args.img_list != None): if (args.img_list != None):
f = open(args.img_list) f = open(args.img_list)
lines = f.readlines() lines = f.readlines()
for im_path in lines: for im_path in lines:
...@@ -92,5 +80,6 @@ def main(): ...@@ -92,5 +80,6 @@ def main():
im_path = args.img im_path = args.img
predictor.predict(im_path) predictor.predict(im_path)
if __name__ == "__main__": if __name__ == "__main__":
main() main()
...@@ -20,19 +20,19 @@ ...@@ -20,19 +20,19 @@
namespace PaddleX { namespace PaddleX {
void Model::create_predictor(const std::string& model_dir, void Model::create_predictor(const std::string& model_dir,
const std::string& cfg_dir, const std::string& cfg_file,
int thread_num) { int thread_num) {
paddle::lite_api::MobileConfig config; paddle::lite_api::MobileConfig config;
config.set_model_from_file(model_dir); config.set_model_from_file(model_dir);
config.set_threads(thread_num); config.set_threads(thread_num);
load_config(cfg_dir); load_config(cfg_file);
predictor_ = predictor_ =
paddle::lite_api::CreatePaddlePredictor<paddle::lite_api::MobileConfig>( paddle::lite_api::CreatePaddlePredictor<paddle::lite_api::MobileConfig>(
config); config);
} }
bool Model::load_config(const std::string& cfg_dir) { bool Model::load_config(const std::string& cfg_file) {
YAML::Node config = YAML::LoadFile(cfg_dir); YAML::Node config = YAML::LoadFile(cfg_file);
type = config["_Attributes"]["model_type"].as<std::string>(); type = config["_Attributes"]["model_type"].as<std::string>();
name = config["Model"].as<std::string>(); name = config["Model"].as<std::string>();
bool to_rgb = true; bool to_rgb = true;
......
...@@ -71,7 +71,7 @@ ARCH=x86 ...@@ -71,7 +71,7 @@ ARCH=x86
| --image | 要预测的图片文件路径 | | --image | 要预测的图片文件路径 |
| --image_list | 按行存储图片路径的.txt文件 | | --image_list | 按行存储图片路径的.txt文件 |
| --device | 运行的平台,可选项{"CPU","MYRIAD"},默认值为"CPU",如在VPU上请使用"MYRIAD"| | --device | 运行的平台,可选项{"CPU","MYRIAD"},默认值为"CPU",如在VPU上请使用"MYRIAD"|
| --cfg_dir | PaddleX model 的.yml配置文件 | | --cfg_file | PaddleX model 的.yml配置文件 |
| --save_dir | 可视化结果图片保存地址,仅适用于检测任务,默认值为" "既不保存可视化结果 | | --save_dir | 可视化结果图片保存地址,仅适用于检测任务,默认值为" "既不保存可视化结果 |
### 样例 ### 样例
...@@ -80,7 +80,7 @@ linux系统在CPU下做单张图片的分类任务预测 ...@@ -80,7 +80,7 @@ linux系统在CPU下做单张图片的分类任务预测
测试图片 `/path/to/test_img.jpeg` 测试图片 `/path/to/test_img.jpeg`
```shell ```shell
./build/classifier --model_dir=/path/to/openvino_model --image=/path/to/test_img.jpeg --cfg_dir=/path/to/PadlleX_model.yml ./build/classifier --model_dir=/path/to/openvino_model --image=/path/to/test_img.jpeg --cfg_file=/path/to/PadlleX_model.yml
``` ```
...@@ -95,7 +95,7 @@ linux系统在CPU下做多张图片的检测任务预测,并保存预测可视 ...@@ -95,7 +95,7 @@ linux系统在CPU下做多张图片的检测任务预测,并保存预测可视
``` ```
```shell ```shell
./build/detector --model_dir=/path/to/models/openvino_model --image_list=/root/projects/images_list.txt --cfg_dir=/path/to/PadlleX_model.yml --save_dir ./output ./build/detector --model_dir=/path/to/models/openvino_model --image_list=/root/projects/images_list.txt --cfg_file=/path/to/PadlleX_model.yml --save_dir ./output
``` ```
`样例三`: `样例三`:
...@@ -103,7 +103,7 @@ linux系统在CPU下做多张图片的检测任务预测,并保存预测可视 ...@@ -103,7 +103,7 @@ linux系统在CPU下做多张图片的检测任务预测,并保存预测可视
测试图片 `/path/to/test_img.jpeg` 测试图片 `/path/to/test_img.jpeg`
```shell ```shell
./build/classifier --model_dir=/path/to/openvino_model --image=/path/to/test_img.jpeg --cfg_dir=/path/to/PadlleX_model.yml --device=MYRIAD ./build/classifier --model_dir=/path/to/openvino_model --image=/path/to/test_img.jpeg --cfg_file=/path/to/PadlleX_model.yml --device=MYRIAD
``` ```
## 性能测试 ## 性能测试
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
| --img | 要预测的图片文件路径 | | --img | 要预测的图片文件路径 |
| --image_list | 按行存储图片路径的.txt文件 | | --image_list | 按行存储图片路径的.txt文件 |
| --device | 运行的平台, 默认值为"CPU" | | --device | 运行的平台, 默认值为"CPU" |
| --cfg_dir | PaddleX model 的.yml配置文件 | | --cfg_file | PaddleX model 的.yml配置文件 |
### 样例 ### 样例
`样例一` `样例一`
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
``` ```
cd /root/projects/python cd /root/projects/python
python demo.py --model_dir /path/to/openvino_model --img /path/to/test_img.jpeg --cfg_dir /path/to/PadlleX_model.yml python demo.py --model_dir /path/to/openvino_model --img /path/to/test_img.jpeg --cfg_file /path/to/PadlleX_model.yml
``` ```
样例二`: 样例二`:
...@@ -45,7 +45,5 @@ python demo.py --model_dir /path/to/openvino_model --img /path/to/test_img.jpeg ...@@ -45,7 +45,5 @@ python demo.py --model_dir /path/to/openvino_model --img /path/to/test_img.jpeg
``` ```
cd /root/projects/python cd /root/projects/python
python demo.py --model_dir /path/to/models/openvino_model --image_list /root/projects/images_list.txt --cfg_dir=/path/to/PadlleX_model.yml python demo.py --model_dir /path/to/models/openvino_model --image_list /root/projects/images_list.txt --cfg_file=/path/to/PadlleX_model.yml
``` ```
...@@ -81,7 +81,7 @@ cd D:\projects\PaddleX\deploy\openvino\out\build\x64-Release ...@@ -81,7 +81,7 @@ cd D:\projects\PaddleX\deploy\openvino\out\build\x64-Release
| --image | 要预测的图片文件路径 | | --image | 要预测的图片文件路径 |
| --image_list | 按行存储图片路径的.txt文件 | | --image_list | 按行存储图片路径的.txt文件 |
| --device | 运行的平台,可选项{"CPU","MYRIAD"},默认值为"CPU",如在VPU上请使用"MYRIAD"| | --device | 运行的平台,可选项{"CPU","MYRIAD"},默认值为"CPU",如在VPU上请使用"MYRIAD"|
| --cfg_dir | PaddleX model 的.yml配置文件 | | --cfg_file | PaddleX model 的.yml配置文件 |
| --save_dir | 可视化结果图片保存地址,仅适用于检测任务,默认值为" "既不保存可视化结果 | | --save_dir | 可视化结果图片保存地址,仅适用于检测任务,默认值为" "既不保存可视化结果 |
### 样例 ### 样例
...@@ -90,7 +90,7 @@ cd D:\projects\PaddleX\deploy\openvino\out\build\x64-Release ...@@ -90,7 +90,7 @@ cd D:\projects\PaddleX\deploy\openvino\out\build\x64-Release
测试图片 `/path/to/test_img.jpeg` 测试图片 `/path/to/test_img.jpeg`
```shell ```shell
./classifier.exe --model_dir=/path/to/openvino_model --image=/path/to/test_img.jpeg --cfg_dir=/path/to/PadlleX_model.yml ./classifier.exe --model_dir=/path/to/openvino_model --image=/path/to/test_img.jpeg --cfg_file=/path/to/PadlleX_model.yml
``` ```
`样例二`: `样例二`:
...@@ -104,7 +104,7 @@ cd D:\projects\PaddleX\deploy\openvino\out\build\x64-Release ...@@ -104,7 +104,7 @@ cd D:\projects\PaddleX\deploy\openvino\out\build\x64-Release
``` ```
```shell ```shell
./detector.exe --model_dir=/path/to/models/openvino_model --image_list=/root/projects/images_list.txt --cfg_dir=/path/to/PadlleX_model.yml --save_dir ./output ./detector.exe --model_dir=/path/to/models/openvino_model --image_list=/root/projects/images_list.txt --cfg_file=/path/to/PadlleX_model.yml --save_dir ./output
``` ```
`样例三`: `样例三`:
...@@ -112,5 +112,5 @@ cd D:\projects\PaddleX\deploy\openvino\out\build\x64-Release ...@@ -112,5 +112,5 @@ cd D:\projects\PaddleX\deploy\openvino\out\build\x64-Release
测试图片 `/path/to/test_img.jpeg` 测试图片 `/path/to/test_img.jpeg`
```shell ```shell
.classifier.exe --model_dir=/path/to/openvino_model --image=/path/to/test_img.jpeg --cfg_dir=/path/to/PadlleX_model.yml --device=MYRIAD .classifier.exe --model_dir=/path/to/openvino_model --image=/path/to/test_img.jpeg --cfg_file=/path/to/PadlleX_model.yml --device=MYRIAD
``` ```
...@@ -91,7 +91,7 @@ OPENCV_DIR=$(pwd)/deps/opencv/ ...@@ -91,7 +91,7 @@ OPENCV_DIR=$(pwd)/deps/opencv/
| --image | 要预测的图片文件路径 | | --image | 要预测的图片文件路径 |
| --image_list | 按行存储图片路径的.txt文件 | | --image_list | 按行存储图片路径的.txt文件 |
| --thread_num | 预测的线程数,默认值为1 | | --thread_num | 预测的线程数,默认值为1 |
| --cfg_dir | PaddleX model 的.yml配置文件 | | --cfg_file | PaddleX model 的.yml配置文件 |
| --save_dir | 可视化结果图片保存地址,仅适用于检测和分割任务,默认值为" "既不保存可视化结果 | | --save_dir | 可视化结果图片保存地址,仅适用于检测和分割任务,默认值为" "既不保存可视化结果 |
### 样例 ### 样例
...@@ -101,7 +101,7 @@ OPENCV_DIR=$(pwd)/deps/opencv/ ...@@ -101,7 +101,7 @@ OPENCV_DIR=$(pwd)/deps/opencv/
```shell ```shell
./build/classifier --model_dir=/path/to/nb_model ./build/classifier --model_dir=/path/to/nb_model
--image=/path/to/test_img.jpeg --cfg_dir=/path/to/PadlleX_model.yml --thread_num=4 --image=/path/to/test_img.jpeg --cfg_file=/path/to/PadlleX_model.yml --thread_num=4
``` ```
...@@ -116,7 +116,7 @@ OPENCV_DIR=$(pwd)/deps/opencv/ ...@@ -116,7 +116,7 @@ OPENCV_DIR=$(pwd)/deps/opencv/
``` ```
```shell ```shell
./build/segmenter --model_dir=/path/to/models/nb_model --image_list=/root/projects/images_list.txt --cfg_dir=/path/to/PadlleX_model.yml --save_dir ./output --thread_num=4 ./build/segmenter --model_dir=/path/to/models/nb_model --image_list=/root/projects/images_list.txt --cfg_file=/path/to/PadlleX_model.yml --save_dir ./output --thread_num=4
``` ```
## 性能测试 ## 性能测试
......
...@@ -22,7 +22,7 @@ python -m pip install paddlelite ...@@ -22,7 +22,7 @@ python -m pip install paddlelite
| --model_dir | 模型转换生成的.xml文件路径,请保证模型转换生成的三个文件在同一路径下| | --model_dir | 模型转换生成的.xml文件路径,请保证模型转换生成的三个文件在同一路径下|
| --img | 要预测的图片文件路径 | | --img | 要预测的图片文件路径 |
| --image_list | 按行存储图片路径的.txt文件 | | --image_list | 按行存储图片路径的.txt文件 |
| --cfg_dir | PaddleX model 的.yml配置文件 | | --cfg_file | PaddleX model 的.yml配置文件 |
| --thread_num | 预测的线程数, 默认值为1 | | --thread_num | 预测的线程数, 默认值为1 |
| --input_shape | 模型输入中图片输入的大小[N,C,H.W] | | --input_shape | 模型输入中图片输入的大小[N,C,H.W] |
...@@ -33,7 +33,7 @@ python -m pip install paddlelite ...@@ -33,7 +33,7 @@ python -m pip install paddlelite
``` ```
cd /root/projects/python cd /root/projects/python
python demo.py --model_dir /path/to/openvino_model --img /path/to/test_img.jpeg --cfg_dir /path/to/PadlleX_model.yml --thread_num 4 --input_shape [1,3,224,224] python demo.py --model_dir /path/to/openvino_model --img /path/to/test_img.jpeg --cfg_file /path/to/PadlleX_model.yml --thread_num 4 --input_shape [1,3,224,224]
``` ```
样例二`: 样例二`:
...@@ -50,5 +50,5 @@ python demo.py --model_dir /path/to/openvino_model --img /path/to/test_img.jpeg ...@@ -50,5 +50,5 @@ python demo.py --model_dir /path/to/openvino_model --img /path/to/test_img.jpeg
``` ```
cd /root/projects/python cd /root/projects/python
python demo.py --model_dir /path/to/models/openvino_model --image_list /root/projects/images_list.txt --cfg_dir=/path/to/PadlleX_model.yml --thread_num 4 --input_shape [1,3,224,224] python demo.py --model_dir /path/to/models/openvino_model --image_list /root/projects/images_list.txt --cfg_file=/path/to/PadlleX_model.yml --thread_num 4 --input_shape [1,3,224,224]
``` ```
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册