pub struct SegmentAnythingBuilder { /* private fields */ }
Expand description
A builder for SegmentAnything
.
Implementations§
source§impl SegmentAnythingBuilder
impl SegmentAnythingBuilder
sourcepub fn source(self, source: SegmentAnythingSource) -> Self
pub fn source(self, source: SegmentAnythingSource) -> Self
Sets the source of the model.
sourcepub fn build(self) -> Result<SegmentAnything>
pub fn build(self) -> Result<SegmentAnything>
Builds the SegmentAnything
model.
Examples found in repository?
More examples
examples/segment-anything.rs (line 4)
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
fn main() {
let model = SegmentAnything::builder().build().unwrap();
let image = image::open("examples/landscape.jpg").unwrap();
let x = image.width() / 2;
let y = image.height() / 4;
let images = model
.segment_from_points(
SegmentAnythingInferenceSettings::new(image)
.unwrap()
.add_goal_point(x, y),
)
.unwrap();
images.save("out.png").unwrap();
}
Trait Implementations§
source§impl Default for SegmentAnythingBuilder
impl Default for SegmentAnythingBuilder
source§fn default() -> SegmentAnythingBuilder
fn default() -> SegmentAnythingBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl RefUnwindSafe for SegmentAnythingBuilder
impl Send for SegmentAnythingBuilder
impl Sync for SegmentAnythingBuilder
impl Unpin for SegmentAnythingBuilder
impl UnwindSafe for SegmentAnythingBuilder
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian()
.