pub struct Network { /* private fields */ }Expand description
The network wrapper type for Darknet.
Implementations§
Source§impl Network
impl Network
Sourcepub fn load<C, W>(
cfg: C,
weights: Option<W>,
clear: bool,
) -> Result<Network, Error>
pub fn load<C, W>( cfg: C, weights: Option<W>, clear: bool, ) -> Result<Network, Error>
Build the network instance from a configuration file and an optional weights file.
This will abort the program with an exit code of 1 if any of the following occur.
- The config has no sections.
- The first section of the config is not
[net]or[network]. fopenfails on [weights] (if provided).- The weights file is invalid
Returns an Err if cfg or [weights] (if provided) contain a null byte.
Sourcepub fn input_width(&self) -> usize
pub fn input_width(&self) -> usize
Get network input width.
Sourcepub fn input_height(&self) -> usize
pub fn input_height(&self) -> usize
Get network input height.
Sourcepub fn input_channels(&self) -> usize
pub fn input_channels(&self) -> usize
Get network input channels.
Sourcepub fn input_shape(&self) -> (usize, usize, usize)
pub fn input_shape(&self) -> (usize, usize, usize)
Get network input shape tuple (channels, height, width).
Sourcepub fn num_layers(&self) -> usize
pub fn num_layers(&self) -> usize
Get the number of layers.
Sourcepub fn predict<'a, M>(
&mut self,
image: M,
thresh: f32,
hier_thres: f32,
nms: f32,
use_letter_box: bool,
) -> Detectionswhere
M: IntoCowImage<'a>,
pub fn predict<'a, M>(
&mut self,
image: M,
thresh: f32,
hier_thres: f32,
nms: f32,
use_letter_box: bool,
) -> Detectionswhere
M: IntoCowImage<'a>,
Run inference on an image.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Network
impl RefUnwindSafe for Network
impl !Sync for Network
impl Unpin for Network
impl UnwindSafe for Network
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more