fix: svtr decode bug (#8)

This commit is contained in:
oatiz
2024-04-17 20:11:11 +08:00
committed by GitHub
parent a86000d107
commit 91049fc18a
4 changed files with 7 additions and 4 deletions

View File

@ -24,8 +24,9 @@ cargo run -r --example svtr
## Results
```shell
[Texts] from the background, but also separate text instances which
[Texts] are closely jointed. Some examples are illustrated in Fig.7.
[Texts] from the background, but also separate text instances which
[Texts] are closely jointed. Some examples are illustrated in Fig.7.
[Texts] 你有这么高速运转的机械进入中国,记住我给出的原理
[Texts] 110022345
[Texts] 冀B6G000
```

View File

@ -4,8 +4,8 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
// build model
let options = Options::default()
.with_i00((1, 2, 8).into())
.with_i03((320, 1500, 2200).into())
.with_confs(&[0.6])
.with_i03((320, 960, 1600).into())
.with_confs(&[0.4])
.with_vocab("../ppocr_rec_vocab.txt")
.with_model("../models/ppocr-v4-svtr-ch-dyn.onnx");
let mut model = SVTR::new(&options)?;
@ -16,6 +16,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
DataLoader::try_read("./examples/svtr/text2.png")?,
DataLoader::try_read("./examples/svtr/text3.png")?,
DataLoader::try_read("./examples/svtr/text4.png")?,
DataLoader::try_read("./examples/svtr/text5.png")?,
];
// run

BIN
examples/svtr/text5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -72,6 +72,7 @@ impl SVTR {
}
if idx == 0 || idx == self.vocab.len() - 1 {
text_ids.push(*text_id);
return text_ids;
}