mirror of
https://github.com/mii443/usls.git
synced 2025-08-22 23:55:38 +00:00
0.1.0-beta.1 (#82)
This commit is contained in:
@ -64,10 +64,7 @@ fn main() -> Result<()> {
|
||||
let mut model = SAM::new(options_encoder, options_decoder)?;
|
||||
|
||||
// Load image
|
||||
let xs = [DataLoader::try_read("images/truck.jpg")?];
|
||||
|
||||
// Build annotator
|
||||
let annotator = Annotator::default().with_saveout(model.spec());
|
||||
let xs = DataLoader::try_read_n(&["images/truck.jpg"])?;
|
||||
|
||||
// Prompt
|
||||
let prompts = vec![
|
||||
@ -79,7 +76,18 @@ fn main() -> Result<()> {
|
||||
|
||||
// Run & Annotate
|
||||
let ys = model.forward(&xs, &prompts)?;
|
||||
annotator.annotate(&xs, &ys);
|
||||
|
||||
// annotate
|
||||
let annotator = Annotator::default();
|
||||
for (x, y) in xs.iter().zip(ys.iter()) {
|
||||
annotator.annotate(x, y)?.save(format!(
|
||||
"{}.jpg",
|
||||
usls::Dir::Current
|
||||
.base_dir_with_subs(&["runs", model.spec()])?
|
||||
.join(usls::timestamp(None))
|
||||
.display(),
|
||||
))?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
Reference in New Issue
Block a user