[Bug Fix] Fixed PFLD infer demo (#482)

* support face alignment PFLD

* add PFLD demo

* fixed FaceAlignmentResult

* fixed bugs

* fixed img size

* fixed readme

* deal with comments

* fixed readme

* add pfld testcase

* update infer.py

* add gflags for example

* update c++ readme

* add gflags in example

* fixed for ci

* fixed gflags.cmake

* deal with comments

* update infer demo

* fixed bug in infer.cc

Co-authored-by: Jason <jiangjiajun@baidu.com>
This commit is contained in:
WJJ1995
2022-11-02 20:30:00 +08:00
committed by GitHub
parent a231c9e7f3
commit 39229bf4e0

14
examples/vision/facealign/pfld/cpp/infer.cc Normal file → Executable file
View File

@@ -35,9 +35,9 @@ void PrintUsage() {
} }
bool CreateRuntimeOption(fastdeploy::RuntimeOption* option) { bool CreateRuntimeOption(fastdeploy::RuntimeOption* option) {
if (FLAG_device == "gpu") { if (FLAGS_device == "gpu") {
option->UseGpu(); option->UseGpu();
if (FLAG_backend == "ort") { if (FLAGS_backend == "ort") {
option->UseOrtBackend(); option->UseOrtBackend();
} else if (FLAGS_backend == "paddle") { } else if (FLAGS_backend == "paddle") {
option->UsePaddleBackend(); option->UsePaddleBackend();
@@ -54,24 +54,24 @@ bool CreateRuntimeOption(fastdeploy::RuntimeOption* option) {
} else if (FLAGS_backend == "default") { } else if (FLAGS_backend == "default") {
return true; return true;
} else { } else {
std::cout << "While inference with GPU, only support default/ort/paddle/trt/paddle_trt now, " << FLAG_backend << " is not supported." << std::endl; std::cout << "While inference with GPU, only support default/ort/paddle/trt/paddle_trt now, " << FLAGS_backend << " is not supported." << std::endl;
return false; return false;
} }
} else if (FLAG_device == "cpu") { } else if (FLAGS_device == "cpu") {
if (FLAGS_backend == "ort") { if (FLAGS_backend == "ort") {
option->UseOrtBackend(); option->UseOrtBackend();
} else if (FLAGS_backend == "ov") { } else if (FLAGS_backend == "ov") {
option->UseOpenVINOBackend(); option->UseOpenVINOBackend();
} else if (FLAGS_backend == "paddle") { } else if (FLAGS_backend == "paddle") {
option->UsePaddleBackend(); option->UsePaddleBackend();
} else if (FLAGS_backend = "default") { } else if (FLAGS_backend == "default") {
return true; return true;
} else { } else {
std::cout << "While inference with CPU, only support default/ort/ov/paddle now, " << FLAG_backend << " is not supported." << std::endl; std::cout << "While inference with CPU, only support default/ort/ov/paddle now, " << FLAGS_backend << " is not supported." << std::endl;
return false; return false;
} }
} else { } else {
std::cerr << "Only support device CPU/GPU now, " << FLAG_device << " is not supported." << std::endl; std::cerr << "Only support device CPU/GPU now, " << FLAGS_device << " is not supported." << std::endl;
return false; return false;
} }