public class Model
extends java.lang.Object
| Constructor and Description |
|---|
Model(Net network)
Create model from deep learning network.
|
Model(java.lang.String model)
Create model from deep learning network represented in one of the supported formats.
|
Model(java.lang.String model,
java.lang.String config)
Create model from deep learning network represented in one of the supported formats.
|
| Modifier and Type | Method and Description |
|---|---|
static Model |
__fromPtr__(long addr) |
long |
getNativeObjAddr() |
void |
predict(Mat frame,
java.util.List<Mat> outs)
Given the
input frame, create input blob, run net and return the output blobs. |
Model |
setInputCrop(boolean crop)
Set flag crop for frame.
|
Model |
setInputMean(Scalar mean)
Set mean value for frame.
|
void |
setInputParams()
Set preprocessing parameters for frame.
|
void |
setInputParams(double scale)
Set preprocessing parameters for frame.
|
void |
setInputParams(double scale,
Size size)
Set preprocessing parameters for frame.
|
void |
setInputParams(double scale,
Size size,
Scalar mean)
Set preprocessing parameters for frame.
|
void |
setInputParams(double scale,
Size size,
Scalar mean,
boolean swapRB)
Set preprocessing parameters for frame.
|
void |
setInputParams(double scale,
Size size,
Scalar mean,
boolean swapRB,
boolean crop)
Set preprocessing parameters for frame.
|
Model |
setInputScale(double scale)
Set scalefactor value for frame.
|
Model |
setInputSize(int width,
int height) |
Model |
setInputSize(Size size)
Set input size for frame.
|
Model |
setInputSwapRB(boolean swapRB)
Set flag swapRB for frame.
|
Model |
setPreferableBackend(int backendId) |
Model |
setPreferableTarget(int targetId) |
public Model(Net network)
network - Net object.public Model(java.lang.String model)
model and config arguments does not matter.model - Binary file contains trained weights.public Model(java.lang.String model,
java.lang.String config)
model and config arguments does not matter.model - Binary file contains trained weights.config - Text file contains network configuration.public static Model __fromPtr__(long addr)
public long getNativeObjAddr()
public void predict(Mat frame, java.util.List<Mat> outs)
input frame, create input blob, run net and return the output blobs.outs - Allocated output blobs, which will store results of the computation.frame - automatically generatedpublic Model setInputCrop(boolean crop)
crop - Flag which indicates whether image will be cropped after resize or not.public Model setInputMean(Scalar mean)
mean - Scalar with mean values which are subtracted from channels.public void setInputParams()
public void setInputParams(double scale)
scale - Multiplier for frame values.
blob(n, c, y, x) = scale * resize( frame(y, x, c) ) - mean(c) )public void setInputParams(double scale,
Size size)
size - New input size.scale - Multiplier for frame values.
blob(n, c, y, x) = scale * resize( frame(y, x, c) ) - mean(c) )public void setInputParams(double scale,
Size size,
Scalar mean)
size - New input size.mean - Scalar with mean values which are subtracted from channels.scale - Multiplier for frame values.
blob(n, c, y, x) = scale * resize( frame(y, x, c) ) - mean(c) )public void setInputParams(double scale,
Size size,
Scalar mean,
boolean swapRB)
size - New input size.mean - Scalar with mean values which are subtracted from channels.scale - Multiplier for frame values.swapRB - Flag which indicates that swap first and last channels.
blob(n, c, y, x) = scale * resize( frame(y, x, c) ) - mean(c) )public void setInputParams(double scale,
Size size,
Scalar mean,
boolean swapRB,
boolean crop)
size - New input size.mean - Scalar with mean values which are subtracted from channels.scale - Multiplier for frame values.swapRB - Flag which indicates that swap first and last channels.crop - Flag which indicates whether image will be cropped after resize or not.
blob(n, c, y, x) = scale * resize( frame(y, x, c) ) - mean(c) )public Model setInputScale(double scale)
scale - Multiplier for frame values.public Model setInputSize(int width, int height)
width - New input width.height - New input height.public Model setInputSize(Size size)
size - New input size.
Note: If shape of the new blob less than 0, then frame size not change.public Model setInputSwapRB(boolean swapRB)
swapRB - Flag which indicates that swap first and last channels.public Model setPreferableBackend(int backendId)
public Model setPreferableTarget(int targetId)
Generated on 2021-12-25 08:13:27 / OpenCV 4.5.5