diff options
author | Laurent Mazare <laurent.mazare@gmail.com> | 2023-09-07 21:45:16 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-07 21:45:16 +0100 |
commit | 79c27fc489f2eece486fa433a0ae75c66a398e6f (patch) | |
tree | c86b89b2c1270cf3207c5242de27c6b069652044 /candle-examples/examples/segment-anything/main.rs | |
parent | 7396b8ed1a5394c58fcc772e5f6e6038577505b8 (diff) | |
download | candle-79c27fc489f2eece486fa433a0ae75c66a398e6f.tar.gz candle-79c27fc489f2eece486fa433a0ae75c66a398e6f.tar.bz2 candle-79c27fc489f2eece486fa433a0ae75c66a398e6f.zip |
Segment-anything fixes: avoid normalizing twice. (#767)
* Segment-anything fixes: avoid normalizing twice.
* More fixes for the image aspect ratio.
Diffstat (limited to 'candle-examples/examples/segment-anything/main.rs')
-rw-r--r-- | candle-examples/examples/segment-anything/main.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/candle-examples/examples/segment-anything/main.rs b/candle-examples/examples/segment-anything/main.rs index a2722270..03ebe346 100644 --- a/candle-examples/examples/segment-anything/main.rs +++ b/candle-examples/examples/segment-anything/main.rs @@ -108,7 +108,8 @@ pub fn main() -> anyhow::Result<()> { let device = candle_examples::device(args.cpu)?; - let image = candle_examples::imagenet::load_image224(args.image)?.to_device(&device)?; + let image = + candle_examples::load_image(args.image, Some(model_sam::IMAGE_SIZE))?.to_device(&device)?; println!("loaded image {image:?}"); let model = match args.model { @@ -125,7 +126,7 @@ pub fn main() -> anyhow::Result<()> { let sam = model_sam::Sam::new(768, 12, 12, &[2, 5, 8, 11], vb)?; // sam_vit_b let (mask, iou_predictions) = sam.forward(&image, false)?; - println!("mask: {mask:?}"); + println!("mask:\n{mask}"); println!("iou_predictions: {iou_predictions:?}"); Ok(()) } |