Struct opencv::dnn::NormalizeBBoxLayer
source · pub struct NormalizeBBoxLayer { /* private fields */ }
Expand description
- normalization layer.
Parameters
- p: Normalization factor. The most common
p = 1
for- normalization or
p = 2
for- normalization or a custom one.
- eps: Parameter
to prevent a division by zero.
- across_spatial: If true, normalize an input across all non-batch dimensions. Otherwise normalize an every channel separately.
Across spatial: @f[ norm = \sqrt[p]{\epsilon + \sum_{x, y, c} |src(x, y, c)|^p } \ dst(x, y, c) = \frac{ src(x, y, c) }{norm} @f]
Channel wise normalization: @f[ norm(c) = \sqrt[p]{\epsilon + \sum_{x, y} |src(x, y, c)|^p } \ dst(x, y, c) = \frac{ src(x, y, c) }{norm(c)} @f]
Where x, y
- spatial coordinates, c
- channel.
An every sample in the batch is normalized separately. Optionally, output is scaled by the trained parameters.
Implementations
sourceimpl NormalizeBBoxLayer
impl NormalizeBBoxLayer
pub fn create(params: &LayerParams) -> Result<Ptr<NormalizeBBoxLayer>>
Trait Implementations
sourceimpl AlgorithmTrait for NormalizeBBoxLayer
impl AlgorithmTrait for NormalizeBBoxLayer
sourceimpl AlgorithmTraitConst for NormalizeBBoxLayer
impl AlgorithmTraitConst for NormalizeBBoxLayer
fn as_raw_Algorithm(&self) -> *const c_void
sourcefn write(&self, fs: &mut FileStorage) -> Result<()>
fn write(&self, fs: &mut FileStorage) -> Result<()>
Stores algorithm parameters in a file storage
sourcefn write_with_name(&self, fs: &Ptr<FileStorage>, name: &str) -> Result<()>
fn write_with_name(&self, fs: &Ptr<FileStorage>, name: &str) -> Result<()>
simplified API for language bindings
Stores algorithm parameters in a file storage Read more
sourcefn empty(&self) -> Result<bool>
fn empty(&self) -> Result<bool>
Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read
sourcefn save(&self, filename: &str) -> Result<()>
fn save(&self, filename: &str) -> Result<()>
Saves the algorithm to a file.
In order to make this method work, the derived class must implement Algorithm::write(FileStorage& fs). Read more
sourcefn get_default_name(&self) -> Result<String>
fn get_default_name(&self) -> Result<String>
Returns the algorithm string identifier.
This string is used as top level xml/yml node tag when the object is saved to a file or string. Read more
sourceimpl Boxed for NormalizeBBoxLayer
impl Boxed for NormalizeBBoxLayer
sourceimpl Drop for NormalizeBBoxLayer
impl Drop for NormalizeBBoxLayer
sourceimpl From<NormalizeBBoxLayer> for Algorithm
impl From<NormalizeBBoxLayer> for Algorithm
sourcefn from(s: NormalizeBBoxLayer) -> Self
fn from(s: NormalizeBBoxLayer) -> Self
Converts to this type from the input type.
sourceimpl From<NormalizeBBoxLayer> for Layer
impl From<NormalizeBBoxLayer> for Layer
sourcefn from(s: NormalizeBBoxLayer) -> Self
fn from(s: NormalizeBBoxLayer) -> Self
Converts to this type from the input type.
sourceimpl LayerTrait for NormalizeBBoxLayer
impl LayerTrait for NormalizeBBoxLayer
fn as_raw_mut_Layer(&mut self) -> *mut c_void
sourcefn set_blobs(&mut self, val: Vector<Mat>)
fn set_blobs(&mut self, val: Vector<Mat>)
List of learned parameters must be stored here to allow read them by using Net::getParam().
sourcefn set_name(&mut self, val: &str)
fn set_name(&mut self, val: &str)
Name of the layer instance, can be used for logging or other internal purposes.
sourcefn set_type(&mut self, val: &str)
fn set_type(&mut self, val: &str)
Type name which was used for creating layer by layer factory.
sourcefn set_preferable_target(&mut self, val: i32)
fn set_preferable_target(&mut self, val: i32)
prefer target for layer forwarding
sourcefn finalize(
&mut self,
inputs: &dyn ToInputArray,
outputs: &mut dyn ToOutputArray
) -> Result<()>
fn finalize(
&mut self,
inputs: &dyn ToInputArray,
outputs: &mut dyn ToOutputArray
) -> Result<()>
Computes and sets internal parameters according to inputs, outputs and blobs. Read more
sourcefn forward_mat(
&mut self,
input: &mut Vector<Mat>,
output: &mut Vector<Mat>,
internals: &mut Vector<Mat>
) -> Result<()>
fn forward_mat(
&mut self,
input: &mut Vector<Mat>,
output: &mut Vector<Mat>,
internals: &mut Vector<Mat>
) -> Result<()>
👎Deprecated: Use Layer::forward(InputArrayOfArrays, OutputArrayOfArrays, OutputArrayOfArrays) instead
Given the @p input blobs, computes the output @p blobs. Read more
sourcefn forward(
&mut self,
inputs: &dyn ToInputArray,
outputs: &mut dyn ToOutputArray,
internals: &mut dyn ToOutputArray
) -> Result<()>
fn forward(
&mut self,
inputs: &dyn ToInputArray,
outputs: &mut dyn ToOutputArray,
internals: &mut dyn ToOutputArray
) -> Result<()>
Given the @p input blobs, computes the output @p blobs. Read more
sourcefn try_quantize(
&mut self,
scales: &Vector<Vector<f32>>,
zeropoints: &Vector<Vector<i32>>,
params: &mut LayerParams
) -> Result<bool>
fn try_quantize(
&mut self,
scales: &Vector<Vector<f32>>,
zeropoints: &Vector<Vector<i32>>,
params: &mut LayerParams
) -> Result<bool>
Tries to quantize the given layer and compute the quantization parameters required for fixed point implementation. Read more
sourcefn forward_fallback(
&mut self,
inputs: &dyn ToInputArray,
outputs: &mut dyn ToOutputArray,
internals: &mut dyn ToOutputArray
) -> Result<()>
fn forward_fallback(
&mut self,
inputs: &dyn ToInputArray,
outputs: &mut dyn ToOutputArray,
internals: &mut dyn ToOutputArray
) -> Result<()>
Given the @p input blobs, computes the output @p blobs. Read more
sourcefn finalize_mat_to(
&mut self,
inputs: &Vector<Mat>,
outputs: &mut Vector<Mat>
) -> Result<()>
fn finalize_mat_to(
&mut self,
inputs: &Vector<Mat>,
outputs: &mut Vector<Mat>
) -> Result<()>
👎Deprecated: Use Layer::finalize(InputArrayOfArrays, OutputArrayOfArrays) instead
Computes and sets internal parameters according to inputs, outputs and blobs. Read more
sourcefn finalize_mat(&mut self, inputs: &Vector<Mat>) -> Result<Vector<Mat>>
fn finalize_mat(&mut self, inputs: &Vector<Mat>) -> Result<Vector<Mat>>
👎Deprecated: Use Layer::finalize(InputArrayOfArrays, OutputArrayOfArrays) instead
Computes and sets internal parameters according to inputs, outputs and blobs. Read more
sourcefn run(
&mut self,
inputs: &Vector<Mat>,
outputs: &mut Vector<Mat>,
internals: &mut Vector<Mat>
) -> Result<()>
fn run(
&mut self,
inputs: &Vector<Mat>,
outputs: &mut Vector<Mat>,
internals: &mut Vector<Mat>
) -> Result<()>
👎Deprecated: This method will be removed in the future release.
Allocates layer and computes output. Read more
sourcefn input_name_to_index(&mut self, input_name: &str) -> Result<i32>
fn input_name_to_index(&mut self, input_name: &str) -> Result<i32>
Returns index of input blob into the input array. Read more
sourcefn output_name_to_index(&mut self, output_name: &str) -> Result<i32>
fn output_name_to_index(&mut self, output_name: &str) -> Result<i32>
Returns index of output blob in output array. Read more
sourcefn support_backend(&mut self, backend_id: i32) -> Result<bool>
fn support_backend(&mut self, backend_id: i32) -> Result<bool>
Ask layer if it support specific backend for doing computations. Read more
sourcefn init_halide(
&mut self,
inputs: &Vector<Ptr<dyn BackendWrapper>>
) -> Result<Ptr<BackendNode>>
fn init_halide(
&mut self,
inputs: &Vector<Ptr<dyn BackendWrapper>>
) -> Result<Ptr<BackendNode>>
Returns Halide backend node. Read more
fn init_ngraph(
&mut self,
inputs: &Vector<Ptr<dyn BackendWrapper>>,
nodes: &Vector<Ptr<BackendNode>>
) -> Result<Ptr<BackendNode>>
fn init_vk_com(
&mut self,
inputs: &Vector<Ptr<dyn BackendWrapper>>
) -> Result<Ptr<BackendNode>>
fn init_webnn(
&mut self,
inputs: &Vector<Ptr<dyn BackendWrapper>>,
nodes: &Vector<Ptr<BackendNode>>
) -> Result<Ptr<BackendNode>>
sourceunsafe fn init_cuda(
&mut self,
context: *mut c_void,
inputs: &Vector<Ptr<dyn BackendWrapper>>,
outputs: &Vector<Ptr<dyn BackendWrapper>>
) -> Result<Ptr<BackendNode>>
unsafe fn init_cuda(
&mut self,
context: *mut c_void,
inputs: &Vector<Ptr<dyn BackendWrapper>>,
outputs: &Vector<Ptr<dyn BackendWrapper>>
) -> Result<Ptr<BackendNode>>
Returns a CUDA backend node Read more
sourceunsafe fn init_tim_vx(
&mut self,
tim_vx_info: *mut c_void,
inputs_wrapper: &Vector<Ptr<dyn BackendWrapper>>,
outputs_wrapper: &Vector<Ptr<dyn BackendWrapper>>,
is_last: bool
) -> Result<Ptr<BackendNode>>
unsafe fn init_tim_vx(
&mut self,
tim_vx_info: *mut c_void,
inputs_wrapper: &Vector<Ptr<dyn BackendWrapper>>,
outputs_wrapper: &Vector<Ptr<dyn BackendWrapper>>,
is_last: bool
) -> Result<Ptr<BackendNode>>
Returns a TimVX backend node Read more
sourcefn try_attach(&mut self, node: &Ptr<BackendNode>) -> Result<Ptr<BackendNode>>
fn try_attach(&mut self, node: &Ptr<BackendNode>) -> Result<Ptr<BackendNode>>
Implement layers fusing. Read more
sourcefn set_activation(&mut self, layer: &Ptr<ActivationLayer>) -> Result<bool>
fn set_activation(&mut self, layer: &Ptr<ActivationLayer>) -> Result<bool>
Tries to attach to the layer the subsequent activation layer, i.e. do the layer fusion in a partial case. Read more
sourcefn try_fuse(&mut self, top: &mut Ptr<Layer>) -> Result<bool>
fn try_fuse(&mut self, top: &mut Ptr<Layer>) -> Result<bool>
Try to fuse current layer with a next one Read more
sourcefn unset_attached(&mut self) -> Result<()>
fn unset_attached(&mut self) -> Result<()>
“Detaches” all the layers, attached to particular layer.
fn update_memory_shapes(&mut self, inputs: &Vector<MatShape>) -> Result<bool>
fn set_params_from(&mut self, params: &LayerParams) -> Result<()>
sourceimpl LayerTraitConst for NormalizeBBoxLayer
impl LayerTraitConst for NormalizeBBoxLayer
fn as_raw_Layer(&self) -> *const c_void
sourcefn blobs(&self) -> Vector<Mat>
fn blobs(&self) -> Vector<Mat>
List of learned parameters must be stored here to allow read them by using Net::getParam().
sourcefn name(&self) -> String
fn name(&self) -> String
Name of the layer instance, can be used for logging or other internal purposes.
sourcefn preferable_target(&self) -> i32
fn preferable_target(&self) -> i32
prefer target for layer forwarding
sourcefn apply_halide_scheduler(
&self,
node: &mut Ptr<BackendNode>,
inputs: &Vector<Mat>,
outputs: &Vector<Mat>,
target_id: i32
) -> Result<()>
fn apply_halide_scheduler(
&self,
node: &mut Ptr<BackendNode>,
inputs: &Vector<Mat>,
outputs: &Vector<Mat>,
target_id: i32
) -> Result<()>
Automatic Halide scheduling based on layer hyper-parameters. Read more
sourcefn get_scale_shift(&self, scale: &mut Mat, shift: &mut Mat) -> Result<()>
fn get_scale_shift(&self, scale: &mut Mat, shift: &mut Mat) -> Result<()>
Returns parameters of layers with channel-wise multiplication and addition. Read more
sourcefn get_scale_zeropoint(&self, scale: &mut f32, zeropoint: &mut i32) -> Result<()>
fn get_scale_zeropoint(&self, scale: &mut f32, zeropoint: &mut i32) -> Result<()>
Returns scale and zeropoint of layers Read more
fn get_memory_shapes(
&self,
inputs: &Vector<MatShape>,
required_outputs: i32,
outputs: &mut Vector<MatShape>,
internals: &mut Vector<MatShape>
) -> Result<bool>
fn get_flops(
&self,
inputs: &Vector<MatShape>,
outputs: &Vector<MatShape>
) -> Result<i64>
sourceimpl NormalizeBBoxLayerTrait for NormalizeBBoxLayer
impl NormalizeBBoxLayerTrait for NormalizeBBoxLayer
fn as_raw_mut_NormalizeBBoxLayer(&mut self) -> *mut c_void
fn set_pnorm(&mut self, val: f32)
fn set_epsilon(&mut self, val: f32)
fn set_across_spatial(&mut self, val: bool)
sourceimpl TryFrom<Layer> for NormalizeBBoxLayer
impl TryFrom<Layer> for NormalizeBBoxLayer
impl Send for NormalizeBBoxLayer
Auto Trait Implementations
impl RefUnwindSafe for NormalizeBBoxLayer
impl !Sync for NormalizeBBoxLayer
impl Unpin for NormalizeBBoxLayer
impl UnwindSafe for NormalizeBBoxLayer
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more