-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update imageproc crates * Add top-p method for sampling * Add SVTR for text recognition & bug fix
- Loading branch information
Showing
48 changed files
with
1,592 additions
and
961 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,33 @@ | ||
use usls::{models::DB, DataLoader, Options}; | ||
use usls::{models::DB, Annotator, DataLoader, Options}; | ||
|
||
fn main() -> Result<(), Box<dyn std::error::Error>> { | ||
// build model | ||
let options = Options::default() | ||
.with_model("../models/ppocr-v4-db-dyn.onnx") | ||
.with_i00((1, 1, 4).into()) | ||
.with_i02((608, 640, 960).into()) | ||
.with_i03((608, 640, 960).into()) | ||
.with_confs(&[0.7]) | ||
.with_saveout("DB-Text-Detection") | ||
.with_dry_run(5) | ||
.with_i00((1, 4, 8).into()) | ||
.with_i02((608, 960, 1280).into()) | ||
.with_i03((608, 960, 1280).into()) | ||
.with_confs(&[0.4]) | ||
.with_min_width(5.0) | ||
.with_min_height(12.0) | ||
// .with_trt(0) | ||
// .with_fp16(true) | ||
.with_profile(true); | ||
.with_model("../models/ppocr-v4-db-dyn.onnx"); | ||
|
||
let mut model = DB::new(&options)?; | ||
|
||
// load image | ||
let x = DataLoader::try_read("./assets/math.jpg")?; | ||
let x = vec![DataLoader::try_read("./assets/db.png")?]; | ||
|
||
// run | ||
let _y = model.run(&[x])?; | ||
let y = model.run(&x)?; | ||
|
||
// annotate | ||
let annotator = Annotator::default() | ||
.with_polygon_color([255u8, 0u8, 0u8]) | ||
.without_name(true) | ||
.without_polygons(false) | ||
.without_bboxes(false) | ||
.with_saveout("DB-Text-Detection"); | ||
annotator.annotate(&x, &y); | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,22 @@ | ||
use usls::{models::RTDETR, DataLoader, Options, COCO_NAMES_80}; | ||
use usls::{models::RTDETR, Annotator, DataLoader, Options, COCO_NAMES_80}; | ||
|
||
fn main() -> Result<(), Box<dyn std::error::Error>> { | ||
// build model | ||
let options = Options::default() | ||
.with_model("../models/rtdetr-l-f16.onnx") | ||
.with_confs(&[0.4, 0.15]) // person: 0.4, others: 0.15 | ||
.with_names(&COCO_NAMES_80) | ||
.with_saveout("RT-DETR"); | ||
.with_names(&COCO_NAMES_80); | ||
let mut model = RTDETR::new(&options)?; | ||
|
||
// build dataloader | ||
let mut dl = DataLoader::default().load("./assets/bus.jpg")?; | ||
// load image | ||
let x = vec![DataLoader::try_read("./assets/bus.jpg")?]; | ||
|
||
// run | ||
model.run(&dl.next().unwrap().0)?; | ||
let y = model.run(&x)?; | ||
|
||
// annotate | ||
let annotator = Annotator::default().with_saveout("RT-DETR"); | ||
annotator.annotate(&x, &y); | ||
|
||
Ok(()) | ||
} |
Oops, something went wrong.