Package org.opencv.dnn
Class SegmentationModel
- java.lang.Object
-
- org.opencv.dnn.Net
-
- org.opencv.dnn.Model
-
- org.opencv.dnn.SegmentationModel
-
public class SegmentationModel extends Model
This class represents high-level API for segmentation models SegmentationModel allows to set params for preprocessing input image. SegmentationModel creates net from file with trained weights and config, sets preprocessing input, runs forward pass and returns the class prediction for each pixel.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
SegmentationModel(long addr)
SegmentationModel(java.lang.String model)
Create segmentation model from network represented in one of the supported formats.SegmentationModel(java.lang.String model, java.lang.String config)
Create segmentation model from network represented in one of the supported formats.SegmentationModel(Net network)
Create model from deep learning network.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SegmentationModel
__fromPtr__(long addr)
protected void
finalize()
void
segment(Mat frame, Mat mask)
Given theinput
frame, create input blob, run net-
Methods inherited from class org.opencv.dnn.Model
predict, setInputCrop, setInputMean, setInputParams, setInputParams, setInputParams, setInputParams, setInputParams, setInputParams, setInputScale, setInputSize, setInputSize, setInputSwapRB
-
Methods inherited from class org.opencv.dnn.Net
connect, dump, dumpToFile, empty, enableFusion, forward, forward, forward, forward, forward, getFLOPS, getFLOPS, getFLOPS, getFLOPS, getLayer, getLayerId, getLayerNames, getLayersCount, getLayerTypes, getMemoryConsumption, getMemoryConsumption, getMemoryConsumption, getNativeObjAddr, getParam, getParam, getPerfProfile, getUnconnectedOutLayers, getUnconnectedOutLayersNames, readFromModelOptimizer, readFromModelOptimizer, setHalideScheduler, setInput, setInput, setInput, setInput, setInputsNames, setParam, setPreferableBackend, setPreferableTarget
-
-
-
-
Constructor Detail
-
SegmentationModel
protected SegmentationModel(long addr)
-
SegmentationModel
public SegmentationModel(Net network)
Create model from deep learning network.- Parameters:
network
- Net object.
-
SegmentationModel
public SegmentationModel(java.lang.String model, java.lang.String config)
Create segmentation model from network represented in one of the supported formats. An order ofmodel
andconfig
arguments does not matter.- Parameters:
model
- Binary file contains trained weights.config
- Text file contains network configuration.
-
SegmentationModel
public SegmentationModel(java.lang.String model)
Create segmentation model from network represented in one of the supported formats. An order ofmodel
andconfig
arguments does not matter.- Parameters:
model
- Binary file contains trained weights.
-
-
Method Detail
-
__fromPtr__
public static SegmentationModel __fromPtr__(long addr)
-
segment
public void segment(Mat frame, Mat mask)
Given theinput
frame, create input blob, run net- Parameters:
mask
- Allocated class prediction for each pixelframe
- automatically generated
-
-