mirror of
https://github.com/PaddlePaddle/PaddleOCR.git
synced 2025-12-28 07:28:55 +00:00
cpp_infer and python_infer support PP-OCRv5 models (#15410)
* cpp_infer support PP-OCRv5 models * python_infer support PP-OCRv5 models * update version2.x model_list * rollback version2.x model_list * update * update
This commit is contained in:
parent
b0b31c38ae
commit
97d9728a1d
@ -66,7 +66,8 @@ public:
|
||||
if (config["Global"] && config["Global"]["model_name"]) {
|
||||
model_name = config["Global"]["model_name"].as<std::string>();
|
||||
}
|
||||
if (!model_name.empty()) {
|
||||
if (!model_name.empty() && model_name != "PP-OCRv5_mobile_det" &&
|
||||
model_name != "PP-OCRv5_server_det") {
|
||||
std::cerr << "Error: " << model_name << " is currently not supported."
|
||||
<< std::endl;
|
||||
std::exit(EXIT_FAILURE);
|
||||
|
||||
@ -61,7 +61,8 @@ public:
|
||||
if (config["Global"] && config["Global"]["model_name"]) {
|
||||
model_name = config["Global"]["model_name"].as<std::string>();
|
||||
}
|
||||
if (!model_name.empty()) {
|
||||
if (!model_name.empty() && model_name != "PP-OCRv5_mobile_rec" &&
|
||||
model_name != "PP-OCRv5_server_rec") {
|
||||
std::cerr << "Error: " << model_name << " is currently not supported."
|
||||
<< std::endl;
|
||||
std::exit(EXIT_FAILURE);
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
# PaddleOCR 2.x及更低版本支持的模型
|
||||
|
||||
由于串联逻辑和模型训练、推理时用到的配置不同,PaddleOCR 2.x 版本的 PP-OCRv4、PP-OCRv3 系列模型与 PaddleOCR 3.0 及以上版本的 PP-OCRv4、PP-OCRv3 系列模型不能互相使用。
|
||||
由于串联逻辑和模型训练、推理时用到的配置不同,PaddleOCR 2.x 分支的 PP-OCRv4、PP-OCRv3 系列模型与 PaddleOCR 3.0 及以上分支的 PP-OCRv4、PP-OCRv3 系列模型不能互相使用。
|
||||
|
||||
## 检测模型
|
||||
|
||||
|
||||
@ -38,7 +38,10 @@ class TextDetector(object):
|
||||
if os.path.exists(f"{args.det_model_dir}/inference.yml"):
|
||||
model_config = utility.load_config(f"{args.det_model_dir}/inference.yml")
|
||||
model_name = model_config.get("Global", {}).get("model_name", "")
|
||||
if model_name:
|
||||
if model_name and model_name not in [
|
||||
"PP-OCRv5_mobile_det",
|
||||
"PP-OCRv5_server_det",
|
||||
]:
|
||||
raise ValueError(
|
||||
f"{model_name} is not supported. Please check if the model is supported by the PaddleOCR wheel."
|
||||
)
|
||||
|
||||
@ -41,7 +41,10 @@ class TextRecognizer(object):
|
||||
if os.path.exists(f"{args.rec_model_dir}/inference.yml"):
|
||||
model_config = utility.load_config(f"{args.rec_model_dir}/inference.yml")
|
||||
model_name = model_config.get("Global", {}).get("model_name", "")
|
||||
if model_name:
|
||||
if model_name and model_name not in [
|
||||
"PP-OCRv5_mobile_rec",
|
||||
"PP-OCRv5_server_rec",
|
||||
]:
|
||||
raise ValueError(
|
||||
f"{model_name} is not supported. Please check if the model is supported by the PaddleOCR wheel."
|
||||
)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user