pub struct NeuralNetworkImageScaler {
pub channel_scale: f32,
pub blue_bias: f32,
pub green_bias: f32,
pub red_bias: f32,
pub gray_bias: f32,
}Expand description
A neural network preprocessor that performs a scalar multiplication of an image followed by addition of scalar biases to the channels.
Input: X
An image in BGR or RGB format with shape \[3, H, W\]
or in grayscale format with shape \[1, H, W\].
Output: Y
An image with format and shape corresponding to the input.
If the input image is in BGR format:
.. code::
Y\[0, :, :\] = channelScale * X\[0, :, :\] + blueBias
Y\[1, :, :\] = channelScale * X\[1, :, :\] + greenBias
Y\[2, :, :\] = channelScale * X\[2, :, :\] + redBiasIf the input image is in RGB format:
.. code::
Y\[0, :, :\] = channelScale * X\[0, :, :\] + redBias
Y\[1, :, :\] = channelScale * X\[1, :, :\] + greenBias
Y\[2, :, :\] = channelScale * X\[2, :, :\] + blueBiasIf the input image is in grayscale format:
.. code::
Y\[0, :, :\] = channelScale * X\[0, :, :\] + grayBiasFields§
§channel_scale: f32Scalar to be multiplied.
blue_bias: f32Scalar blue bias to be added.
green_bias: f32Scalar green bias to be added.
red_bias: f32Scalar red bias to be added.
gray_bias: f32Scalar bias to be added for grayscale images.
Trait Implementations§
Source§impl Clone for NeuralNetworkImageScaler
impl Clone for NeuralNetworkImageScaler
Source§fn clone(&self) -> NeuralNetworkImageScaler
fn clone(&self) -> NeuralNetworkImageScaler
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for NeuralNetworkImageScaler
impl Debug for NeuralNetworkImageScaler
Source§impl Default for NeuralNetworkImageScaler
impl Default for NeuralNetworkImageScaler
Source§impl Message for NeuralNetworkImageScaler
impl Message for NeuralNetworkImageScaler
Source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Returns the encoded length of the message without a length delimiter.
Source§fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
Encodes the message to a buffer. Read more
Source§fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Encodes the message to a newly allocated buffer.
Source§fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
Encodes the message with a length-delimiter to a buffer. Read more
Source§fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Encodes the message with a length-delimiter to a newly allocated buffer.
Source§fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Decodes an instance of the message from a buffer. Read more
Source§fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Decodes a length-delimited instance of the message from the buffer.
Source§fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
Decodes an instance of the message from a buffer, and merges it into
self. Read moreSource§fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
Decodes a length-delimited instance of the message from buffer, and
merges it into
self.Source§impl PartialEq for NeuralNetworkImageScaler
impl PartialEq for NeuralNetworkImageScaler
Source§fn eq(&self, other: &NeuralNetworkImageScaler) -> bool
fn eq(&self, other: &NeuralNetworkImageScaler) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Copy for NeuralNetworkImageScaler
impl StructuralPartialEq for NeuralNetworkImageScaler
Auto Trait Implementations§
impl Freeze for NeuralNetworkImageScaler
impl RefUnwindSafe for NeuralNetworkImageScaler
impl Send for NeuralNetworkImageScaler
impl Sync for NeuralNetworkImageScaler
impl Unpin for NeuralNetworkImageScaler
impl UnsafeUnpin for NeuralNetworkImageScaler
impl UnwindSafe for NeuralNetworkImageScaler
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