Skip to content

Commit

Permalink
inprogress: paddle ocr
Browse files Browse the repository at this point in the history
  • Loading branch information
wormtql committed Apr 24, 2024
1 parent 8ce50a1 commit 6e04b3a
Show file tree
Hide file tree
Showing 10 changed files with 8,697 additions and 75 deletions.
216 changes: 143 additions & 73 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions yas-genshin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,7 @@ winres = "0.1"
[[bin]]
name = "yas_artifact"
path = "src/bin/artifact_scanner.rs"

[[bin]]
name = "playground"
path = "src/bin/playground.rs"
14 changes: 14 additions & 0 deletions yas-genshin/src/bin/playground.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
use anyhow::Result;
use image::RgbImage;
use yas::ocr::{ImageToText, PPOCRChV4RecInfer, ppocr_model};
use image::io::Reader as ImageReader;

fn main() -> Result<()> {
let model: Box<dyn ImageToText<RgbImage>> = Box::new(PPOCRChV4RecInfer::new()?);
let image = ImageReader::open(r"E:\rust\yas\item_count.png")?.decode()?;
let rgb_image = image.to_rgb8();
let result = model.image_to_text(&rgb_image, false)?;
println!("{}", result);

Ok(())
}
2 changes: 1 addition & 1 deletion yas/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ clap = { version = "4.4", features = ["derive"] }
image = "0.24"
enigo = "0.1"
# ref: https://github.com/sonos/tract#tract-opl-version-compatibility
tract-onnx = "0.17"
tract-onnx = "0.21.1"
serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] }
regex = "1.5"
Expand Down
3 changes: 3 additions & 0 deletions yas/src/ocr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ mod paddle_paddle_model;
pub use yas_model::yas_ocr_model::YasOCRModel;
pub use yas_model::yas_ocr_model::yas_ocr_model;
pub use traits::ImageToText;
pub use paddle_paddle_model::PPOCRModel;
pub use paddle_paddle_model::PPOCRChV4RecInfer;
pub use paddle_paddle_model::ppocr_model;
3 changes: 3 additions & 0 deletions yas/src/ocr/paddle_paddle_model/ch_PP-OCRv4_rec_infer.onnx
Git LFS file not shown
Loading

0 comments on commit 6e04b3a

Please sign in to comment.