Add svtr_en model

This commit is contained in:
jamjamjon
2025-01-25 01:53:13 +08:00
parent 94fa832359
commit bdd77a6d21
2 changed files with 24 additions and 8 deletions

View File

@ -23,6 +23,7 @@ fn main() -> Result<()> {
// build model // build model
let options = Options::ppocr_rec_v4_ch() let options = Options::ppocr_rec_v4_ch()
// ppocr_rec_v4_en()
// repsvtr_ch() // repsvtr_ch()
.with_model_device(args.device.as_str().try_into()?) .with_model_device(args.device.as_str().try_into()?)
.with_model_dtype(args.dtype.as_str().try_into()?) .with_model_dtype(args.dtype.as_str().try_into()?)

View File

@ -11,34 +11,49 @@ impl crate::Options {
.with_padding_value(0) .with_padding_value(0)
.with_normalize(true) .with_normalize(true)
.with_class_confs(&[0.2]) .with_class_confs(&[0.2])
.with_vocab_txt("vocab-v1-ppocr-rec-ch.txt") }
pub fn svtr_ch() -> Self {
Self::svtr().with_vocab_txt("vocab-v1-ppocr-rec-ch.txt")
}
pub fn svtr_en() -> Self {
Self::svtr().with_vocab_txt("vocab-v1-ppocr-rec-en.txt")
} }
pub fn ppocr_rec_v3_ch() -> Self { pub fn ppocr_rec_v3_ch() -> Self {
Self::svtr().with_model_file("ppocr-v3-ch.onnx") Self::svtr_ch().with_model_file("ppocr-v3-ch.onnx")
} }
pub fn ppocr_rec_v4_ch() -> Self { pub fn ppocr_rec_v4_ch() -> Self {
Self::svtr().with_model_file("ppocr-v4-ch.onnx") Self::svtr_ch().with_model_file("ppocr-v4-ch.onnx")
}
pub fn ppocr_rec_v3_en() -> Self {
Self::svtr_en().with_model_file("ppocr-v3-en.onnx")
}
pub fn ppocr_rec_v4_en() -> Self {
Self::svtr_en().with_model_file("ppocr-v4-en.onnx")
} }
pub fn ppocr_rec_v4_server_ch() -> Self { pub fn ppocr_rec_v4_server_ch() -> Self {
Self::svtr().with_model_file("ppocr-v4-server-ch.onnx") Self::svtr_ch().with_model_file("ppocr-v4-server-ch.onnx")
} }
pub fn svtr_v2_server_ch() -> Self { pub fn svtr_v2_server_ch() -> Self {
Self::svtr().with_model_file("v2-server-ch.onnx") Self::svtr_ch().with_model_file("v2-server-ch.onnx")
} }
pub fn repsvtr_ch() -> Self { pub fn repsvtr_ch() -> Self {
Self::svtr().with_model_file("repsvtr-ch.onnx") Self::svtr_ch().with_model_file("repsvtr-ch.onnx")
} }
pub fn svtr_v2_teacher_ch() -> Self { pub fn svtr_v2_teacher_ch() -> Self {
Self::svtr().with_model_file("v2-distill-teacher-ch.onnx") Self::svtr_ch().with_model_file("v2-distill-teacher-ch.onnx")
} }
pub fn svtr_v2_student_ch() -> Self { pub fn svtr_v2_student_ch() -> Self {
Self::svtr().with_model_file("v2-distill-student-ch.onnx") Self::svtr_ch().with_model_file("v2-distill-student-ch.onnx")
} }
} }