pub trait NetTraitConst {
Show 32 methods
// Required method
fn as_raw_Net(&self) -> *const c_void;
// Provided methods
fn empty(&self) -> Result<bool> { ... }
fn get_layer_id(&self, layer: &str) -> Result<i32> { ... }
fn get_layer_names(&self) -> Result<Vector<String>> { ... }
fn get_layer(&self, layer_id: i32) -> Result<Ptr<Layer>> { ... }
fn get_layer_1(&self, layer_name: &str) -> Result<Ptr<Layer>> { ... }
fn get_layer_2(
&self,
layer_id: &impl DictValueTraitConst,
) -> Result<Ptr<Layer>> { ... }
fn get_layer_inputs(&self, layer_id: i32) -> Result<Vector<Ptr<Layer>>> { ... }
fn get_input_details(
&self,
scales: &mut Vector<f32>,
zeropoints: &mut Vector<i32>,
) -> Result<()> { ... }
fn get_output_details(
&self,
scales: &mut Vector<f32>,
zeropoints: &mut Vector<i32>,
) -> Result<()> { ... }
fn get_param(&self, layer: i32, num_param: i32) -> Result<Mat> { ... }
fn get_param_def(&self, layer: i32) -> Result<Mat> { ... }
fn get_param_1(&self, layer_name: &str, num_param: i32) -> Result<Mat> { ... }
fn get_param_def_1(&self, layer_name: &str) -> Result<Mat> { ... }
fn get_unconnected_out_layers(&self) -> Result<Vector<i32>> { ... }
fn get_unconnected_out_layers_names(&self) -> Result<Vector<String>> { ... }
fn get_layers_shapes(
&self,
net_input_shapes: &Vector<MatShape>,
layers_ids: &mut Vector<i32>,
in_layers_shapes: &mut Vector<Vector<MatShape>>,
out_layers_shapes: &mut Vector<Vector<MatShape>>,
) -> Result<()> { ... }
fn get_layers_shapes_1(
&self,
net_input_shape: &MatShape,
layers_ids: &mut Vector<i32>,
in_layers_shapes: &mut Vector<Vector<MatShape>>,
out_layers_shapes: &mut Vector<Vector<MatShape>>,
) -> Result<()> { ... }
fn get_layer_shapes(
&self,
net_input_shape: &MatShape,
layer_id: i32,
in_layer_shapes: &mut Vector<MatShape>,
out_layer_shapes: &mut Vector<MatShape>,
) -> Result<()> { ... }
fn get_layer_shapes_1(
&self,
net_input_shapes: &Vector<MatShape>,
layer_id: i32,
in_layer_shapes: &mut Vector<MatShape>,
out_layer_shapes: &mut Vector<MatShape>,
) -> Result<()> { ... }
fn get_flops(&self, net_input_shapes: &Vector<MatShape>) -> Result<i64> { ... }
fn get_flops_1(&self, net_input_shape: &MatShape) -> Result<i64> { ... }
fn get_flops_2(
&self,
layer_id: i32,
net_input_shapes: &Vector<MatShape>,
) -> Result<i64> { ... }
fn get_flops_3(
&self,
layer_id: i32,
net_input_shape: &MatShape,
) -> Result<i64> { ... }
fn get_layer_types(&self, layers_types: &mut Vector<String>) -> Result<()> { ... }
fn get_layers_count(&self, layer_type: &str) -> Result<i32> { ... }
fn get_memory_consumption(
&self,
net_input_shapes: &Vector<MatShape>,
weights: &mut size_t,
blobs: &mut size_t,
) -> Result<()> { ... }
fn get_memory_consumption_1(
&self,
net_input_shape: &MatShape,
weights: &mut size_t,
blobs: &mut size_t,
) -> Result<()> { ... }
fn get_memory_consumption_for_layer(
&self,
layer_id: i32,
net_input_shapes: &Vector<MatShape>,
weights: &mut size_t,
blobs: &mut size_t,
) -> Result<()> { ... }
fn get_memory_consumption_2(
&self,
layer_id: i32,
net_input_shape: &MatShape,
weights: &mut size_t,
blobs: &mut size_t,
) -> Result<()> { ... }
fn get_memory_consumption_for_layers(
&self,
net_input_shapes: &Vector<MatShape>,
layer_ids: &mut Vector<i32>,
weights: &mut Vector<size_t>,
blobs: &mut Vector<size_t>,
) -> Result<()> { ... }
fn get_memory_consumption_3(
&self,
net_input_shape: &MatShape,
layer_ids: &mut Vector<i32>,
weights: &mut Vector<size_t>,
blobs: &mut Vector<size_t>,
) -> Result<()> { ... }
}
Expand description
Constant methods for crate::dnn::Net
Required Methods§
fn as_raw_Net(&self) -> *const c_void
Provided Methods§
Sourcefn get_layer_id(&self, layer: &str) -> Result<i32>
fn get_layer_id(&self, layer: &str) -> Result<i32>
Converts string name of the layer to the integer identifier.
§Returns
id of the layer, or -1 if the layer wasn’t found.
fn get_layer_names(&self) -> Result<Vector<String>>
Sourcefn get_layer(&self, layer_id: i32) -> Result<Ptr<Layer>>
fn get_layer(&self, layer_id: i32) -> Result<Ptr<Layer>>
Returns pointer to layer with specified id or name which the network use.
Sourcefn get_layer_1(&self, layer_name: &str) -> Result<Ptr<Layer>>
👎Deprecated: Use int getLayerId(const String &layer)
fn get_layer_1(&self, layer_name: &str) -> Result<Ptr<Layer>>
Returns pointer to layer with specified id or name which the network use.
§Overloaded parameters
Deprecated: Use int getLayerId(const String &layer)
Sourcefn get_layer_2(&self, layer_id: &impl DictValueTraitConst) -> Result<Ptr<Layer>>
👎Deprecated: to be removed
fn get_layer_2(&self, layer_id: &impl DictValueTraitConst) -> Result<Ptr<Layer>>
Returns pointer to layer with specified id or name which the network use.
§Overloaded parameters
Deprecated: to be removed
Sourcefn get_layer_inputs(&self, layer_id: i32) -> Result<Vector<Ptr<Layer>>>
fn get_layer_inputs(&self, layer_id: i32) -> Result<Vector<Ptr<Layer>>>
Returns pointers to input layers of specific layer.
Sourcefn get_input_details(
&self,
scales: &mut Vector<f32>,
zeropoints: &mut Vector<i32>,
) -> Result<()>
fn get_input_details( &self, scales: &mut Vector<f32>, zeropoints: &mut Vector<i32>, ) -> Result<()>
Returns input scale and zeropoint for a quantized Net.
§Parameters
- scales: output parameter for returning input scales.
- zeropoints: output parameter for returning input zeropoints.
Sourcefn get_output_details(
&self,
scales: &mut Vector<f32>,
zeropoints: &mut Vector<i32>,
) -> Result<()>
fn get_output_details( &self, scales: &mut Vector<f32>, zeropoints: &mut Vector<i32>, ) -> Result<()>
Returns output scale and zeropoint for a quantized Net.
§Parameters
- scales: output parameter for returning output scales.
- zeropoints: output parameter for returning output zeropoints.
Sourcefn get_param_def(&self, layer: i32) -> Result<Mat>
fn get_param_def(&self, layer: i32) -> Result<Mat>
Returns parameter blob of the layer.
§Parameters
- layer: name or id of the layer.
- numParam: index of the layer parameter in the Layer::blobs array.
§See also
Layer::blobs
§Note
This alternative version of NetTraitConst::get_param function uses the following default values for its arguments:
- num_param: 0
Sourcefn get_param_1(&self, layer_name: &str, num_param: i32) -> Result<Mat>
fn get_param_1(&self, layer_name: &str, num_param: i32) -> Result<Mat>
§C++ default parameters
- num_param: 0
Sourcefn get_param_def_1(&self, layer_name: &str) -> Result<Mat>
fn get_param_def_1(&self, layer_name: &str) -> Result<Mat>
§Note
This alternative version of NetTraitConst::get_param function uses the following default values for its arguments:
- num_param: 0
Sourcefn get_unconnected_out_layers(&self) -> Result<Vector<i32>>
fn get_unconnected_out_layers(&self) -> Result<Vector<i32>>
Returns indexes of layers with unconnected outputs.
FIXIT: Rework API to registerOutput() approach, deprecate this call
Sourcefn get_unconnected_out_layers_names(&self) -> Result<Vector<String>>
fn get_unconnected_out_layers_names(&self) -> Result<Vector<String>>
Returns names of layers with unconnected outputs.
FIXIT: Rework API to registerOutput() approach, deprecate this call
Sourcefn get_layers_shapes(
&self,
net_input_shapes: &Vector<MatShape>,
layers_ids: &mut Vector<i32>,
in_layers_shapes: &mut Vector<Vector<MatShape>>,
out_layers_shapes: &mut Vector<Vector<MatShape>>,
) -> Result<()>
fn get_layers_shapes( &self, net_input_shapes: &Vector<MatShape>, layers_ids: &mut Vector<i32>, in_layers_shapes: &mut Vector<Vector<MatShape>>, out_layers_shapes: &mut Vector<Vector<MatShape>>, ) -> Result<()>
Returns input and output shapes for all layers in loaded model; preliminary inferencing isn’t necessary.
§Parameters
- netInputShapes: shapes for all input blobs in net input layer.
- layersIds: output parameter for layer IDs.
- inLayersShapes: output parameter for input layers shapes; order is the same as in layersIds
- outLayersShapes: output parameter for output layers shapes; order is the same as in layersIds
Sourcefn get_layers_shapes_1(
&self,
net_input_shape: &MatShape,
layers_ids: &mut Vector<i32>,
in_layers_shapes: &mut Vector<Vector<MatShape>>,
out_layers_shapes: &mut Vector<Vector<MatShape>>,
) -> Result<()>
fn get_layers_shapes_1( &self, net_input_shape: &MatShape, layers_ids: &mut Vector<i32>, in_layers_shapes: &mut Vector<Vector<MatShape>>, out_layers_shapes: &mut Vector<Vector<MatShape>>, ) -> Result<()>
Returns input and output shapes for all layers in loaded model; preliminary inferencing isn’t necessary.
§Parameters
- netInputShapes: shapes for all input blobs in net input layer.
- layersIds: output parameter for layer IDs.
- inLayersShapes: output parameter for input layers shapes; order is the same as in layersIds
- outLayersShapes: output parameter for output layers shapes; order is the same as in layersIds
§Overloaded parameters
Sourcefn get_layer_shapes(
&self,
net_input_shape: &MatShape,
layer_id: i32,
in_layer_shapes: &mut Vector<MatShape>,
out_layer_shapes: &mut Vector<MatShape>,
) -> Result<()>
fn get_layer_shapes( &self, net_input_shape: &MatShape, layer_id: i32, in_layer_shapes: &mut Vector<MatShape>, out_layer_shapes: &mut Vector<MatShape>, ) -> Result<()>
Returns input and output shapes for layer with specified id in loaded model; preliminary inferencing isn’t necessary.
§Parameters
- netInputShape: shape input blob in net input layer.
- layerId: id for layer.
- inLayerShapes: output parameter for input layers shapes; order is the same as in layersIds
- outLayerShapes: output parameter for output layers shapes; order is the same as in layersIds
Sourcefn get_layer_shapes_1(
&self,
net_input_shapes: &Vector<MatShape>,
layer_id: i32,
in_layer_shapes: &mut Vector<MatShape>,
out_layer_shapes: &mut Vector<MatShape>,
) -> Result<()>
fn get_layer_shapes_1( &self, net_input_shapes: &Vector<MatShape>, layer_id: i32, in_layer_shapes: &mut Vector<MatShape>, out_layer_shapes: &mut Vector<MatShape>, ) -> Result<()>
Returns input and output shapes for layer with specified id in loaded model; preliminary inferencing isn’t necessary.
§Parameters
- netInputShape: shape input blob in net input layer.
- layerId: id for layer.
- inLayerShapes: output parameter for input layers shapes; order is the same as in layersIds
- outLayerShapes: output parameter for output layers shapes; order is the same as in layersIds
§Overloaded parameters
Sourcefn get_flops_1(&self, net_input_shape: &MatShape) -> Result<i64>
fn get_flops_1(&self, net_input_shape: &MatShape) -> Result<i64>
Sourcefn get_layer_types(&self, layers_types: &mut Vector<String>) -> Result<()>
fn get_layer_types(&self, layers_types: &mut Vector<String>) -> Result<()>
Returns list of types for layer used in model.
§Parameters
- layersTypes: output parameter for returning types.
Sourcefn get_layers_count(&self, layer_type: &str) -> Result<i32>
fn get_layers_count(&self, layer_type: &str) -> Result<i32>
Sourcefn get_memory_consumption(
&self,
net_input_shapes: &Vector<MatShape>,
weights: &mut size_t,
blobs: &mut size_t,
) -> Result<()>
fn get_memory_consumption( &self, net_input_shapes: &Vector<MatShape>, weights: &mut size_t, blobs: &mut size_t, ) -> Result<()>
Computes bytes number which are required to store all weights and intermediate blobs for model.
§Parameters
- netInputShapes: vector of shapes for all net inputs.
- weights: output parameter to store resulting bytes for weights.
- blobs: output parameter to store resulting bytes for intermediate blobs.
Sourcefn get_memory_consumption_1(
&self,
net_input_shape: &MatShape,
weights: &mut size_t,
blobs: &mut size_t,
) -> Result<()>
fn get_memory_consumption_1( &self, net_input_shape: &MatShape, weights: &mut size_t, blobs: &mut size_t, ) -> Result<()>
Computes bytes number which are required to store all weights and intermediate blobs for model.
§Parameters
- netInputShapes: vector of shapes for all net inputs.
- weights: output parameter to store resulting bytes for weights.
- blobs: output parameter to store resulting bytes for intermediate blobs.
§Overloaded parameters
Sourcefn get_memory_consumption_for_layer(
&self,
layer_id: i32,
net_input_shapes: &Vector<MatShape>,
weights: &mut size_t,
blobs: &mut size_t,
) -> Result<()>
fn get_memory_consumption_for_layer( &self, layer_id: i32, net_input_shapes: &Vector<MatShape>, weights: &mut size_t, blobs: &mut size_t, ) -> Result<()>
Computes bytes number which are required to store all weights and intermediate blobs for model.
§Parameters
- netInputShapes: vector of shapes for all net inputs.
- weights: output parameter to store resulting bytes for weights.
- blobs: output parameter to store resulting bytes for intermediate blobs.
§Overloaded parameters
Sourcefn get_memory_consumption_2(
&self,
layer_id: i32,
net_input_shape: &MatShape,
weights: &mut size_t,
blobs: &mut size_t,
) -> Result<()>
fn get_memory_consumption_2( &self, layer_id: i32, net_input_shape: &MatShape, weights: &mut size_t, blobs: &mut size_t, ) -> Result<()>
Computes bytes number which are required to store all weights and intermediate blobs for model.
§Parameters
- netInputShapes: vector of shapes for all net inputs.
- weights: output parameter to store resulting bytes for weights.
- blobs: output parameter to store resulting bytes for intermediate blobs.
§Overloaded parameters
Sourcefn get_memory_consumption_for_layers(
&self,
net_input_shapes: &Vector<MatShape>,
layer_ids: &mut Vector<i32>,
weights: &mut Vector<size_t>,
blobs: &mut Vector<size_t>,
) -> Result<()>
fn get_memory_consumption_for_layers( &self, net_input_shapes: &Vector<MatShape>, layer_ids: &mut Vector<i32>, weights: &mut Vector<size_t>, blobs: &mut Vector<size_t>, ) -> Result<()>
Computes bytes number which are required to store all weights and intermediate blobs for each layer.
§Parameters
- netInputShapes: vector of shapes for all net inputs.
- layerIds: output vector to save layer IDs.
- weights: output parameter to store resulting bytes for weights.
- blobs: output parameter to store resulting bytes for intermediate blobs.
Sourcefn get_memory_consumption_3(
&self,
net_input_shape: &MatShape,
layer_ids: &mut Vector<i32>,
weights: &mut Vector<size_t>,
blobs: &mut Vector<size_t>,
) -> Result<()>
fn get_memory_consumption_3( &self, net_input_shape: &MatShape, layer_ids: &mut Vector<i32>, weights: &mut Vector<size_t>, blobs: &mut Vector<size_t>, ) -> Result<()>
Computes bytes number which are required to store all weights and intermediate blobs for each layer.
§Parameters
- netInputShapes: vector of shapes for all net inputs.
- layerIds: output vector to save layer IDs.
- weights: output parameter to store resulting bytes for weights.
- blobs: output parameter to store resulting bytes for intermediate blobs.
§Overloaded parameters
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.