diff options
author | zachcp <zachcp@users.noreply.github.com> | 2024-11-17 14:27:24 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-17 20:27:24 +0100 |
commit | 12d7e7b1450f0c3f87c3cce3a2a1dd1674cb8fd7 (patch) | |
tree | 0d0b59c5538f1a61b6e9022b1bb7b39b6834db5d /candle-transformers/src/models/segment_anything/mod.rs | |
parent | a3f200e36991418c25cddef0e09c426deea90606 (diff) | |
download | candle-12d7e7b1450f0c3f87c3cce3a2a1dd1674cb8fd7.tar.gz candle-12d7e7b1450f0c3f87c3cce3a2a1dd1674cb8fd7.tar.bz2 candle-12d7e7b1450f0c3f87c3cce3a2a1dd1674cb8fd7.zip |
More Model Module Docs (#2623)
* dinov2
* add another example
* ad dinov2reg4
* eva2
* efficientvit
* moondream
* update t5
* update t5
* rwkv
* stable diffusion docs
* add wasm link
* add segment_anything
* adjsut for clippy
* ignore bertdoc
* dinov2 ignore
* update block to be text
* remove the rust blocks for the moment
* bump python to 3.11
* add a setup-python step
* add py311 to test as well
Diffstat (limited to 'candle-transformers/src/models/segment_anything/mod.rs')
-rw-r--r-- | candle-transformers/src/models/segment_anything/mod.rs | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/candle-transformers/src/models/segment_anything/mod.rs b/candle-transformers/src/models/segment_anything/mod.rs index 3e85fe35..fe0b0990 100644 --- a/candle-transformers/src/models/segment_anything/mod.rs +++ b/candle-transformers/src/models/segment_anything/mod.rs @@ -1,10 +1,33 @@ //! Segment Anything Model (SAM) //! //! SAM is an architecture for image segmentation, capable of segmenting any object -//! in an image based on prompts like points or boxes. +//! in an image based on prompts like points or boxes. //! This model provides a robust and fast image segmentation pipeline that can be tweaked via +//! some prompting (requesting some points to be in the target mask, requesting some +//! points to be part of the background so _not_ in the target mask, specifying some +//! bounding box). //! -//! - [GH Link](https://github.com/facebookresearch/segment-anything) -//! - [Paper](https://arxiv.org/abs/2304.02643) +//! - ⚡ [Interactive Wasm Example](https://huggingface.co/spaces/radames/candle-segment-anything-wasm) +//! - 💻 [GH Link](https://github.com/facebookresearch/segment-anything) +//! - 📝 [Paper](https://arxiv.org/abs/2304.02643) +//! - 💡 The default backbone can be replaced by the smaller and faster TinyViT model based on [MobileSAM](https://github.com/ChaoningZhang/MobileSAM). +//! +//! +//! ## Example +//! +//! ```bash +//! cargo run --example segment-anything --release -- \ +//! --image candle-examples/examples/yolo-v8/assets/bike.jpg +//! --use-tiny --point 0.6,0.6 --point 0.6,0.55 +//! ``` +//! +//! <div align=center style="display: flex; justify-content: center; gap: 10px;"> +//! <img src="https://github.com/huggingface/candle/raw/main/candle-examples/examples/yolo-v8/assets/bike.jpg" alt="" width="30%"> +//! <img src="https://github.com/huggingface/candle/raw/main/candle-examples/examples/segment-anything/assets/single_pt_prompt.jpg" alt="" width="30%"> +//! <img src="https://github.com/huggingface/candle/raw/main/candle-examples/examples/segment-anything/assets/two_pt_prompt.jpg" alt="" width="30%"> +//! </div> +//! +//! +//! > Original; Prompt with `--point 0.6,0.55`; Prompt with `--point 0.6,0.6 --point 0.6,0.55` //! pub use crate::models::with_tracing::Linear; use candle::{Result, Tensor}; |