@Namespace(value="cv::dnn") @NoOffset @Properties(inherit=opencv_dnn.class) public class Net extends Pointer
Modifier and Type | Class and Description |
---|---|
static class |
Net.Impl |
Pointer.CustomDeallocator, Pointer.Deallocator, Pointer.NativeDeallocator, Pointer.ReferenceCounter
Constructor and Description |
---|
Net()
Default constructor.
|
Net(long size)
Native array allocator.
|
Net(Pointer p)
Pointer cast constructor.
|
Modifier and Type | Method and Description |
---|---|
int |
addLayer(BytePointer name,
BytePointer type,
int dtype,
LayerParams params)
\brief Adds new layer to the net.
|
int |
addLayer(BytePointer name,
BytePointer type,
LayerParams params)
\overload Datatype of output blobs set to default CV_32F
|
int |
addLayer(String name,
String type,
int dtype,
LayerParams params) |
int |
addLayer(String name,
String type,
LayerParams params) |
int |
addLayerToPrev(BytePointer name,
BytePointer type,
int dtype,
LayerParams params)
\brief Adds new layer and connects its first input to the first output of previously added layer.
|
int |
addLayerToPrev(BytePointer name,
BytePointer type,
LayerParams params)
\overload
|
int |
addLayerToPrev(String name,
String type,
int dtype,
LayerParams params) |
int |
addLayerToPrev(String name,
String type,
LayerParams params) |
void |
connect(BytePointer outPin,
BytePointer inpPin)
\brief Connects output of the first layer to input of the second layer.
|
void |
connect(int outLayerId,
int outNum,
int inpLayerId,
int inpNum)
\brief Connects #\p outNum output of the first layer to #\p inNum input of the second layer.
|
void |
connect(String outPin,
String inpPin) |
BytePointer |
dump()
\brief Dump net to String
|
void |
dumpToFile(BytePointer path)
\brief Dump net structure, hyperparameters, backend, target and fusion to dot file
|
void |
dumpToFile(String path) |
boolean |
empty()
Returns true if there are no layers in the network.
|
void |
enableFusion(boolean fusion)
\brief Enables or disables layer fusion in the network.
|
void |
enableWinograd(boolean useWinograd)
\brief Enables or disables the Winograd compute branch.
|
Mat |
forward() |
Mat |
forward(BytePointer outputName)
\brief Runs forward pass to compute output of layer with name \p outputName.
|
void |
forward(GpuMatVector outputBlobs) |
void |
forward(GpuMatVector outputBlobs,
BytePointer outputName) |
void |
forward(GpuMatVector outputBlobs,
String outputName) |
void |
forward(GpuMatVector outputBlobs,
StringVector outBlobNames) |
void |
forward(MatVector outputBlobs) |
void |
forward(MatVector outputBlobs,
BytePointer outputName)
\brief Runs forward pass to compute output of layer with name \p outputName.
|
void |
forward(MatVector outputBlobs,
String outputName) |
void |
forward(MatVector outputBlobs,
StringVector outBlobNames)
\brief Runs forward pass to compute outputs of layers listed in \p outBlobNames.
|
Mat |
forward(String outputName) |
void |
forward(UMatVector outputBlobs) |
void |
forward(UMatVector outputBlobs,
BytePointer outputName) |
void |
forward(UMatVector outputBlobs,
String outputName) |
void |
forward(UMatVector outputBlobs,
StringVector outBlobNames) |
void |
forwardAndRetrieve(MatVectorVector outputBlobs,
StringVector outBlobNames)
\brief Runs forward pass to compute outputs of layers listed in \p outBlobNames.
|
AsyncArray |
forwardAsync() |
AsyncArray |
forwardAsync(BytePointer outputName)
\brief Runs forward pass to compute output of layer with name \p outputName.
|
AsyncArray |
forwardAsync(String outputName) |
long |
getFLOPS(int layerId,
IntPointer netInputShape)
\overload
|
long |
getFLOPS(int layerId,
MatShapeVector netInputShapes)
\overload
|
long |
getFLOPS(IntPointer netInputShape)
\overload
|
long |
getFLOPS(MatShapeVector netInputShapes)
\brief Computes FLOP for whole loaded model with specified input shapes.
|
Net.Impl |
getImpl() |
Net.Impl |
getImplRef() |
void |
getInputDetails(float[] scales,
int[] zeropoints) |
void |
getInputDetails(FloatBuffer scales,
IntBuffer zeropoints) |
void |
getInputDetails(FloatPointer scales,
IntPointer zeropoints)
\brief Returns input scale and zeropoint for a quantized Net.
|
Layer |
getLayer(BytePointer layerName)
Deprecated.
Use int getLayerId(const String &layer)
|
Layer |
getLayer(DictValue layerId)
Deprecated.
to be removed
|
Layer |
getLayer(int layerId)
\brief Returns pointer to layer with specified id or name which the network use.
|
Layer |
getLayer(String layerName) |
int |
getLayerId(BytePointer layer)
\brief Converts string name of the layer to the integer identifier.
|
int |
getLayerId(String layer) |
StringVector |
getLayerNames() |
int |
getLayersCount(BytePointer layerType)
\brief Returns count of layers of specified type.
|
int |
getLayersCount(String layerType) |
void |
getLayerShapes(IntPointer netInputShape,
int layerId,
MatShapeVector inLayerShapes,
MatShapeVector outLayerShapes)
\brief Returns input and output shapes for layer with specified
id in loaded model; preliminary inferencing isn't necessary.
|
void |
getLayerShapes(MatShapeVector netInputShapes,
int layerId,
MatShapeVector inLayerShapes,
MatShapeVector outLayerShapes)
\overload
|
void |
getLayersShapes(IntPointer netInputShape,
int[] layersIds,
MatShapeVectorVector inLayersShapes,
MatShapeVectorVector outLayersShapes) |
void |
getLayersShapes(IntPointer netInputShape,
IntBuffer layersIds,
MatShapeVectorVector inLayersShapes,
MatShapeVectorVector outLayersShapes) |
void |
getLayersShapes(IntPointer netInputShape,
IntPointer layersIds,
MatShapeVectorVector inLayersShapes,
MatShapeVectorVector outLayersShapes)
\overload
|
void |
getLayersShapes(MatShapeVector netInputShapes,
int[] layersIds,
MatShapeVectorVector inLayersShapes,
MatShapeVectorVector outLayersShapes) |
void |
getLayersShapes(MatShapeVector netInputShapes,
IntBuffer layersIds,
MatShapeVectorVector inLayersShapes,
MatShapeVectorVector outLayersShapes) |
void |
getLayersShapes(MatShapeVector netInputShapes,
IntPointer layersIds,
MatShapeVectorVector inLayersShapes,
MatShapeVectorVector outLayersShapes)
\brief Returns input and output shapes for all layers in loaded model;
preliminary inferencing isn't necessary.
|
void |
getLayerTypes(StringVector layersTypes)
\brief Returns list of types for layer used in model.
|
void |
getMemoryConsumption(int layerId,
IntPointer netInputShape,
SizeTPointer weights,
SizeTPointer blobs)
\overload
|
void |
getMemoryConsumption(int layerId,
MatShapeVector netInputShapes,
SizeTPointer weights,
SizeTPointer blobs)
\overload
|
void |
getMemoryConsumption(IntPointer netInputShape,
int[] layerIds,
SizeTPointer weights,
SizeTPointer blobs) |
void |
getMemoryConsumption(IntPointer netInputShape,
IntBuffer layerIds,
SizeTPointer weights,
SizeTPointer blobs) |
void |
getMemoryConsumption(IntPointer netInputShape,
IntPointer layerIds,
SizeTPointer weights,
SizeTPointer blobs)
\overload
|
void |
getMemoryConsumption(IntPointer netInputShape,
SizeTPointer weights,
SizeTPointer blobs)
\overload
|
void |
getMemoryConsumption(MatShapeVector netInputShapes,
int[] layerIds,
SizeTPointer weights,
SizeTPointer blobs) |
void |
getMemoryConsumption(MatShapeVector netInputShapes,
IntBuffer layerIds,
SizeTPointer weights,
SizeTPointer blobs) |
void |
getMemoryConsumption(MatShapeVector netInputShapes,
IntPointer layerIds,
SizeTPointer weights,
SizeTPointer blobs)
\brief Computes bytes number which are required to store
all weights and intermediate blobs for each layer.
|
void |
getMemoryConsumption(MatShapeVector netInputShapes,
SizeTPointer weights,
SizeTPointer blobs)
\brief Computes bytes number which are required to store
all weights and intermediate blobs for model.
|
void |
getOutputDetails(float[] scales,
int[] zeropoints) |
void |
getOutputDetails(FloatBuffer scales,
IntBuffer zeropoints) |
void |
getOutputDetails(FloatPointer scales,
IntPointer zeropoints)
\brief Returns output scale and zeropoint for a quantized Net.
|
Mat |
getParam(BytePointer layerName) |
Mat |
getParam(BytePointer layerName,
int numParam) |
Mat |
getParam(int layer) |
Mat |
getParam(int layer,
int numParam)
\brief Returns parameter blob of the layer.
|
Mat |
getParam(String layerName) |
Mat |
getParam(String layerName,
int numParam) |
long |
getPerfProfile(double[] timings) |
long |
getPerfProfile(DoubleBuffer timings) |
long |
getPerfProfile(DoublePointer timings)
\brief Returns overall time for inference and timings (in ticks) for layers.
|
Net |
getPointer(long i) |
IntPointer |
getUnconnectedOutLayers()
\brief Returns indexes of layers with unconnected outputs.
|
StringVector |
getUnconnectedOutLayersNames()
\brief Returns names of layers with unconnected outputs.
|
Net |
position(long position) |
Net |
quantize(GpuMatVector calibData,
int inputsDtype,
int outputsDtype) |
Net |
quantize(GpuMatVector calibData,
int inputsDtype,
int outputsDtype,
boolean perChannel) |
Net |
quantize(MatVector calibData,
int inputsDtype,
int outputsDtype) |
Net |
quantize(MatVector calibData,
int inputsDtype,
int outputsDtype,
boolean perChannel)
\brief Returns a quantized Net from a floating-point Net.
|
Net |
quantize(UMatVector calibData,
int inputsDtype,
int outputsDtype) |
Net |
quantize(UMatVector calibData,
int inputsDtype,
int outputsDtype,
boolean perChannel) |
static Net |
readFromModelOptimizer(byte[] bufferModelConfig,
byte[] bufferWeights) |
static Net |
readFromModelOptimizer(byte[] bufferModelConfigPtr,
long bufferModelConfigSize,
byte[] bufferWeightsPtr,
long bufferWeightsSize) |
static Net |
readFromModelOptimizer(ByteBuffer bufferModelConfig,
ByteBuffer bufferWeights)
\brief Create a network from Intel's Model Optimizer in-memory buffers with intermediate representation (IR).
|
static Net |
readFromModelOptimizer(ByteBuffer bufferModelConfigPtr,
long bufferModelConfigSize,
ByteBuffer bufferWeightsPtr,
long bufferWeightsSize) |
static Net |
readFromModelOptimizer(BytePointer xml,
BytePointer bin)
\brief Create a network from Intel's Model Optimizer intermediate representation (IR).
|
static Net |
readFromModelOptimizer(BytePointer bufferModelConfigPtr,
long bufferModelConfigSize,
BytePointer bufferWeightsPtr,
long bufferWeightsSize)
\brief Create a network from Intel's Model Optimizer in-memory buffers with intermediate representation (IR).
|
static Net |
readFromModelOptimizer(String xml,
String bin) |
int |
registerOutput(BytePointer outputName,
int layerId,
int outputPort)
\brief Registers network output with name
Function may create additional 'Identity' layer.
|
int |
registerOutput(String outputName,
int layerId,
int outputPort) |
void |
setHalideScheduler(BytePointer scheduler)
\brief Compile Halide layers.
|
void |
setHalideScheduler(String scheduler) |
void |
setInput(GpuMat blob) |
void |
setInput(GpuMat blob,
BytePointer name,
double scalefactor,
Scalar mean) |
void |
setInput(GpuMat blob,
String name,
double scalefactor,
Scalar mean) |
void |
setInput(Mat blob) |
void |
setInput(Mat blob,
BytePointer name,
double scalefactor,
Scalar mean)
\brief Sets the new input value for the network
|
void |
setInput(Mat blob,
String name,
double scalefactor,
Scalar mean) |
void |
setInput(UMat blob) |
void |
setInput(UMat blob,
BytePointer name,
double scalefactor,
Scalar mean) |
void |
setInput(UMat blob,
String name,
double scalefactor,
Scalar mean) |
void |
setInputShape(BytePointer inputName,
IntPointer shape)
\brief Specify shape of network input.
|
void |
setInputShape(String inputName,
IntPointer shape) |
void |
setInputsNames(StringVector inputBlobNames)
\brief Sets outputs names of the network input pseudo layer.
|
void |
setParam(BytePointer layerName,
int numParam,
Mat blob) |
void |
setParam(int layer,
int numParam,
Mat blob)
\brief Sets the new value for the learned param of the layer.
|
void |
setParam(String layerName,
int numParam,
Mat blob) |
void |
setPreferableBackend(int backendId)
\brief Ask network to use specific computation backend where it supported.
|
void |
setPreferableTarget(int targetId)
\brief Ask network to make computations on specific target device.
|
address, asBuffer, asByteBuffer, availablePhysicalBytes, calloc, capacity, capacity, close, deallocate, deallocate, deallocateReferences, deallocator, deallocator, equals, fill, formatBytes, free, getDirectBufferAddress, getPointer, getPointer, getPointer, hashCode, interruptDeallocatorThread, isNull, isNull, limit, limit, malloc, maxBytes, maxPhysicalBytes, memchr, memcmp, memcpy, memmove, memset, offsetAddress, offsetof, offsetof, parseBytes, physicalBytes, physicalBytesInaccurate, position, put, realloc, referenceCount, releaseReference, retainReference, setNull, sizeof, sizeof, toString, totalBytes, totalCount, totalPhysicalBytes, withDeallocator, zero
public Net(Pointer p)
Pointer(Pointer)
.public Net(long size)
Pointer.position(long)
.public Net()
public Net getPointer(long i)
getPointer
in class Pointer
@ByVal public static Net readFromModelOptimizer(@opencv_core.Str BytePointer xml, @opencv_core.Str BytePointer bin)
xml
- [in] XML configuration file with network's topology.bin
- [in] Binary file with trained weights.
Networks imported from Intel's Model Optimizer are launched in Intel's Inference Engine
backend.@ByVal public static Net readFromModelOptimizer(@opencv_core.Str String xml, @opencv_core.Str String bin)
@ByVal public static Net readFromModelOptimizer(@Cast(value="uchar*") @StdVector ByteBuffer bufferModelConfig, @Cast(value="uchar*") @StdVector ByteBuffer bufferWeights)
bufferModelConfig
- [in] buffer with model's configuration.bufferWeights
- [in] buffer with model's trained weights.@ByVal public static Net readFromModelOptimizer(@Cast(value="uchar*") @StdVector byte[] bufferModelConfig, @Cast(value="uchar*") @StdVector byte[] bufferWeights)
@ByVal public static Net readFromModelOptimizer(@Cast(value="const uchar*") BytePointer bufferModelConfigPtr, @Cast(value="size_t") long bufferModelConfigSize, @Cast(value="const uchar*") BytePointer bufferWeightsPtr, @Cast(value="size_t") long bufferWeightsSize)
bufferModelConfigPtr
- [in] buffer pointer of model's configuration.bufferModelConfigSize
- [in] buffer size of model's configuration.bufferWeightsPtr
- [in] buffer pointer of model's trained weights.bufferWeightsSize
- [in] buffer size of model's trained weights.@ByVal public static Net readFromModelOptimizer(@Cast(value="const uchar*") ByteBuffer bufferModelConfigPtr, @Cast(value="size_t") long bufferModelConfigSize, @Cast(value="const uchar*") ByteBuffer bufferWeightsPtr, @Cast(value="size_t") long bufferWeightsSize)
@ByVal public static Net readFromModelOptimizer(@Cast(value="const uchar*") byte[] bufferModelConfigPtr, @Cast(value="size_t") long bufferModelConfigSize, @Cast(value="const uchar*") byte[] bufferWeightsPtr, @Cast(value="size_t") long bufferWeightsSize)
@Cast(value="bool") public boolean empty()
@opencv_core.Str public BytePointer dump()
public void dumpToFile(@opencv_core.Str BytePointer path)
path
- path to output file with .dot extensiondump()
public void dumpToFile(@opencv_core.Str String path)
public int addLayer(@opencv_core.Str BytePointer name, @opencv_core.Str BytePointer type, int dtype, @ByRef LayerParams params)
name
- unique name of the adding layer.type
- typename of the adding layer (type must be registered in LayerRegister).dtype
- datatype of output blobs.params
- parameters which will be used to initialize the creating layer.public int addLayer(@opencv_core.Str String name, @opencv_core.Str String type, int dtype, @ByRef LayerParams params)
public int addLayer(@opencv_core.Str BytePointer name, @opencv_core.Str BytePointer type, @ByRef LayerParams params)
public int addLayer(@opencv_core.Str String name, @opencv_core.Str String type, @ByRef LayerParams params)
public int addLayerToPrev(@opencv_core.Str BytePointer name, @opencv_core.Str BytePointer type, int dtype, @ByRef LayerParams params)
addLayer()
public int addLayerToPrev(@opencv_core.Str String name, @opencv_core.Str String type, int dtype, @ByRef LayerParams params)
public int addLayerToPrev(@opencv_core.Str BytePointer name, @opencv_core.Str BytePointer type, @ByRef LayerParams params)
public int addLayerToPrev(@opencv_core.Str String name, @opencv_core.Str String type, @ByRef LayerParams params)
public int getLayerId(@opencv_core.Str BytePointer layer)
public int getLayerId(@opencv_core.Str String layer)
@ByVal public StringVector getLayerNames()
@opencv_core.Ptr public Layer getLayer(int layerId)
@opencv_core.Ptr public Layer getLayer(@opencv_core.Str BytePointer layerName)
@opencv_core.Ptr public Layer getLayer(@opencv_core.Str String layerName)
@opencv_core.Ptr public Layer getLayer(@Cast(value="const cv::dnn::Net::LayerId*") @ByRef DictValue layerId)
public void connect(@opencv_core.Str BytePointer outPin, @opencv_core.Str BytePointer inpPin)
outPin
- descriptor of the first layer output.inpPin
- descriptor of the second layer input.
Descriptors have the following template <layer_name>[.input_number]:
- the first part of the template layer_name is string name of the added layer.
If this part is empty then the network input pseudo layer will be used;
- the second optional part of the template input_number
is either number of the layer input, either label one.
If this part is omitted then the first layer input will be used.setNetInputs(), Layer::inputNameToIndex(), Layer::outputNameToIndex()
public void connect(@opencv_core.Str String outPin, @opencv_core.Str String inpPin)
public void connect(int outLayerId, int outNum, int inpLayerId, int inpNum)
outLayerId
- identifier of the first layeroutNum
- number of the first layer outputinpLayerId
- identifier of the second layerinpNum
- number of the second layer inputpublic int registerOutput(@StdString BytePointer outputName, int layerId, int outputPort)
outputName
- identifier of the outputlayerId
- identifier of the second layeroutputPort
- number of the second layer inputpublic int registerOutput(@StdString String outputName, int layerId, int outputPort)
public void setInputsNames(@Const @ByRef StringVector inputBlobNames)
public void setInputShape(@opencv_core.Str BytePointer inputName, @Const @StdVector @ByRef IntPointer shape)
public void setInputShape(@opencv_core.Str String inputName, @Const @StdVector @ByRef IntPointer shape)
@ByVal public Mat forward(@opencv_core.Str BytePointer outputName)
outputName
- name for layer which output is needed to get@ByVal public Mat forward(@opencv_core.Str String outputName)
@ByVal public AsyncArray forwardAsync(@opencv_core.Str BytePointer outputName)
outputName
- name for layer which output is needed to get
\details By default runs forward pass for the whole network.
This is an asynchronous version of forward(const String&).
dnn::DNN_BACKEND_INFERENCE_ENGINE backend is required.@ByVal public AsyncArray forwardAsync()
@ByVal public AsyncArray forwardAsync(@opencv_core.Str String outputName)
public void forward(@ByVal MatVector outputBlobs, @opencv_core.Str BytePointer outputName)
outputBlobs
- contains all output blobs for specified layer.outputName
- name for layer which output is needed to get
\details If \p outputName is empty, runs forward pass for the whole network.public void forward(@ByVal UMatVector outputBlobs, @opencv_core.Str String outputName)
public void forward(@ByVal UMatVector outputBlobs)
public void forward(@ByVal GpuMatVector outputBlobs, @opencv_core.Str BytePointer outputName)
public void forward(@ByVal GpuMatVector outputBlobs)
public void forward(@ByVal MatVector outputBlobs, @opencv_core.Str String outputName)
public void forward(@ByVal UMatVector outputBlobs, @opencv_core.Str BytePointer outputName)
public void forward(@ByVal GpuMatVector outputBlobs, @opencv_core.Str String outputName)
public void forward(@ByVal MatVector outputBlobs, @Const @ByRef StringVector outBlobNames)
outputBlobs
- contains blobs for first outputs of specified layers.outBlobNames
- names for layers which outputs are needed to getpublic void forward(@ByVal UMatVector outputBlobs, @Const @ByRef StringVector outBlobNames)
public void forward(@ByVal GpuMatVector outputBlobs, @Const @ByRef StringVector outBlobNames)
@Name(value="forward") public void forwardAndRetrieve(@ByRef MatVectorVector outputBlobs, @Const @ByRef StringVector outBlobNames)
outputBlobs
- contains all output blobs for each layer specified in \p outBlobNames.outBlobNames
- names for layers which outputs are needed to get@ByVal public Net quantize(@ByVal MatVector calibData, int inputsDtype, int outputsDtype, @Cast(value="bool") boolean perChannel)
calibData
- Calibration data to compute the quantization parameters.inputsDtype
- Datatype of quantized net's inputs. Can be CV_32F or CV_8S.outputsDtype
- Datatype of quantized net's outputs. Can be CV_32F or CV_8S.perChannel
- Quantization granularity of quantized Net. The default is true, that means quantize model
in per-channel way (channel-wise). Set it false to quantize model in per-tensor way (or tensor-wise).@ByVal public Net quantize(@ByVal UMatVector calibData, int inputsDtype, int outputsDtype, @Cast(value="bool") boolean perChannel)
@ByVal public Net quantize(@ByVal UMatVector calibData, int inputsDtype, int outputsDtype)
@ByVal public Net quantize(@ByVal GpuMatVector calibData, int inputsDtype, int outputsDtype, @Cast(value="bool") boolean perChannel)
@ByVal public Net quantize(@ByVal GpuMatVector calibData, int inputsDtype, int outputsDtype)
public void getInputDetails(@StdVector FloatPointer scales, @StdVector IntPointer zeropoints)
scales
- output parameter for returning input scales.zeropoints
- output parameter for returning input zeropoints.public void getInputDetails(@StdVector FloatBuffer scales, @StdVector IntBuffer zeropoints)
public void getInputDetails(@StdVector float[] scales, @StdVector int[] zeropoints)
public void getOutputDetails(@StdVector FloatPointer scales, @StdVector IntPointer zeropoints)
scales
- output parameter for returning output scales.zeropoints
- output parameter for returning output zeropoints.public void getOutputDetails(@StdVector FloatBuffer scales, @StdVector IntBuffer zeropoints)
public void getOutputDetails(@StdVector float[] scales, @StdVector int[] zeropoints)
public void setHalideScheduler(@opencv_core.Str BytePointer scheduler)
scheduler
- [in] Path to YAML file with scheduling directives.Schedule layers that support Halide backend. Then compile them for
specific target. For layers that not represented in scheduling file
or if no manual scheduling used at all, automatic scheduling will be applied.
public void setHalideScheduler(@opencv_core.Str String scheduler)
public void setPreferableBackend(int backendId)
backendId
- [in] backend identifier.Backend
public void setPreferableTarget(int targetId)
targetId
- [in] target identifier.List of supported combinations backend / target:
| | DNN_BACKEND_OPENCV | DNN_BACKEND_INFERENCE_ENGINE | DNN_BACKEND_HALIDE | DNN_BACKEND_CUDA |
|------------------------|--------------------|------------------------------|--------------------|-------------------|
| DNN_TARGET_CPU | + | + | + | |
| DNN_TARGET_OPENCL | + | + | + | |
| DNN_TARGET_OPENCL_FP16 | + | + | | |
| DNN_TARGET_MYRIAD | | + | | |
| DNN_TARGET_FPGA | | + | | |
| DNN_TARGET_CUDA | | | | + |
| DNN_TARGET_CUDA_FP16 | | | | + |
| DNN_TARGET_HDDL | | + | | |
public void setInput(@ByVal Mat blob, @opencv_core.Str BytePointer name, double scalefactor, @Const @ByRef(nullValue="cv::Scalar()") Scalar mean)
blob
- A new blob. Should have CV_32F or CV_8U depth.name
- A name of input layer.scalefactor
- An optional normalization scale.mean
- An optional mean subtraction values.to know format of the descriptor.
If scale or mean values are specified, a final input blob is computed
as:
{@code \[input(n,c,h,w) = scalefactor \times (blob(n,c,h,w) - mean_c)\]}
public void setInput(@ByVal Mat blob, @opencv_core.Str String name, double scalefactor, @Const @ByRef(nullValue="cv::Scalar()") Scalar mean)
public void setInput(@ByVal UMat blob, @opencv_core.Str String name, double scalefactor, @Const @ByRef(nullValue="cv::Scalar()") Scalar mean)
public void setInput(@ByVal UMat blob, @opencv_core.Str BytePointer name, double scalefactor, @Const @ByRef(nullValue="cv::Scalar()") Scalar mean)
public void setInput(@ByVal GpuMat blob, @opencv_core.Str BytePointer name, double scalefactor, @Const @ByRef(nullValue="cv::Scalar()") Scalar mean)
public void setInput(@ByVal GpuMat blob, @opencv_core.Str String name, double scalefactor, @Const @ByRef(nullValue="cv::Scalar()") Scalar mean)
public void setParam(int layer, int numParam, @Const @ByRef Mat blob)
layer
- name or id of the layer.numParam
- index of the layer parameter in the Layer::blobs array.blob
- the new value.\note If shape of the new blob differs from the previous shape,
then the following forward pass may fail.
public void setParam(@opencv_core.Str BytePointer layerName, int numParam, @Const @ByRef Mat blob)
public void setParam(@opencv_core.Str String layerName, int numParam, @Const @ByRef Mat blob)
@ByVal public Mat getParam(int layer, int numParam)
layer
- name or id of the layer.numParam
- index of the layer parameter in the Layer::blobs array.Layer::blobs
@ByVal public Mat getParam(@opencv_core.Str BytePointer layerName, int numParam)
@ByVal public Mat getParam(@opencv_core.Str BytePointer layerName)
@ByVal public Mat getParam(@opencv_core.Str String layerName, int numParam)
@ByVal public Mat getParam(@opencv_core.Str String layerName)
@StdVector public IntPointer getUnconnectedOutLayers()
@ByVal public StringVector getUnconnectedOutLayersNames()
public void getLayersShapes(@Const @ByRef MatShapeVector netInputShapes, @StdVector IntPointer layersIds, @ByRef MatShapeVectorVector inLayersShapes, @ByRef MatShapeVectorVector outLayersShapes)
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 layersIdsoutLayersShapes
- output parameter for output layers shapes;
order is the same as in layersIdspublic void getLayersShapes(@Const @ByRef MatShapeVector netInputShapes, @StdVector IntBuffer layersIds, @ByRef MatShapeVectorVector inLayersShapes, @ByRef MatShapeVectorVector outLayersShapes)
public void getLayersShapes(@Const @ByRef MatShapeVector netInputShapes, @StdVector int[] layersIds, @ByRef MatShapeVectorVector inLayersShapes, @ByRef MatShapeVectorVector outLayersShapes)
public void getLayersShapes(@Const @StdVector @ByRef IntPointer netInputShape, @StdVector IntPointer layersIds, @ByRef MatShapeVectorVector inLayersShapes, @ByRef MatShapeVectorVector outLayersShapes)
public void getLayersShapes(@Const @StdVector @ByRef IntPointer netInputShape, @StdVector IntBuffer layersIds, @ByRef MatShapeVectorVector inLayersShapes, @ByRef MatShapeVectorVector outLayersShapes)
public void getLayersShapes(@Const @StdVector @ByRef IntPointer netInputShape, @StdVector int[] layersIds, @ByRef MatShapeVectorVector inLayersShapes, @ByRef MatShapeVectorVector outLayersShapes)
public void getLayerShapes(@Const @StdVector @ByRef IntPointer netInputShape, int layerId, @ByRef MatShapeVector inLayerShapes, @ByRef MatShapeVector outLayerShapes)
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 layersIdsoutLayerShapes
- output parameter for output layers shapes;
order is the same as in layersIdspublic void getLayerShapes(@Const @ByRef MatShapeVector netInputShapes, int layerId, @ByRef MatShapeVector inLayerShapes, @ByRef MatShapeVector outLayerShapes)
@Cast(value="int64") public long getFLOPS(@Const @ByRef MatShapeVector netInputShapes)
netInputShapes
- vector of shapes for all net inputs.@Cast(value="int64") public long getFLOPS(@Const @StdVector @ByRef IntPointer netInputShape)
@Cast(value="int64") public long getFLOPS(int layerId, @Const @ByRef MatShapeVector netInputShapes)
@Cast(value="int64") public long getFLOPS(int layerId, @Const @StdVector @ByRef IntPointer netInputShape)
public void getLayerTypes(@ByRef StringVector layersTypes)
layersTypes
- output parameter for returning types.public int getLayersCount(@opencv_core.Str BytePointer layerType)
layerType
- type.public int getLayersCount(@opencv_core.Str String layerType)
public void getMemoryConsumption(@Const @ByRef MatShapeVector netInputShapes, @Cast(value="size_t*") @ByRef SizeTPointer weights, @Cast(value="size_t*") @ByRef SizeTPointer blobs)
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.public void getMemoryConsumption(@Const @StdVector @ByRef IntPointer netInputShape, @Cast(value="size_t*") @ByRef SizeTPointer weights, @Cast(value="size_t*") @ByRef SizeTPointer blobs)
public void getMemoryConsumption(int layerId, @Const @ByRef MatShapeVector netInputShapes, @Cast(value="size_t*") @ByRef SizeTPointer weights, @Cast(value="size_t*") @ByRef SizeTPointer blobs)
public void getMemoryConsumption(int layerId, @Const @StdVector @ByRef IntPointer netInputShape, @Cast(value="size_t*") @ByRef SizeTPointer weights, @Cast(value="size_t*") @ByRef SizeTPointer blobs)
public void getMemoryConsumption(@Const @ByRef MatShapeVector netInputShapes, @StdVector IntPointer layerIds, @Cast(value="size_t*") @StdVector SizeTPointer weights, @Cast(value="size_t*") @StdVector SizeTPointer blobs)
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.public void getMemoryConsumption(@Const @ByRef MatShapeVector netInputShapes, @StdVector IntBuffer layerIds, @Cast(value="size_t*") @StdVector SizeTPointer weights, @Cast(value="size_t*") @StdVector SizeTPointer blobs)
public void getMemoryConsumption(@Const @ByRef MatShapeVector netInputShapes, @StdVector int[] layerIds, @Cast(value="size_t*") @StdVector SizeTPointer weights, @Cast(value="size_t*") @StdVector SizeTPointer blobs)
public void getMemoryConsumption(@Const @StdVector @ByRef IntPointer netInputShape, @StdVector IntPointer layerIds, @Cast(value="size_t*") @StdVector SizeTPointer weights, @Cast(value="size_t*") @StdVector SizeTPointer blobs)
public void getMemoryConsumption(@Const @StdVector @ByRef IntPointer netInputShape, @StdVector IntBuffer layerIds, @Cast(value="size_t*") @StdVector SizeTPointer weights, @Cast(value="size_t*") @StdVector SizeTPointer blobs)
public void getMemoryConsumption(@Const @StdVector @ByRef IntPointer netInputShape, @StdVector int[] layerIds, @Cast(value="size_t*") @StdVector SizeTPointer weights, @Cast(value="size_t*") @StdVector SizeTPointer blobs)
public void enableFusion(@Cast(value="bool") boolean fusion)
fusion
- true to enable the fusion, false to disable. The fusion is enabled by default.public void enableWinograd(@Cast(value="bool") boolean useWinograd)
useWinograd
- true to enable the Winograd compute branch. The default is true.@Cast(value="int64") public long getPerfProfile(@StdVector DoublePointer timings)
timings
- [out] vector for tick timings for all layers.@Cast(value="int64") public long getPerfProfile(@StdVector DoubleBuffer timings)
@Cast(value="int64") public long getPerfProfile(@StdVector double[] timings)
public Net.Impl getImpl()
Copyright © 2024. All rights reserved.