🤖 AIによる機械翻訳(非公式) — これは OpenCV 5.0.0 公式リファレンス(英語)を AI (Claude) で自動翻訳したものです。訳に誤りを含む場合があります。正確な情報は 公式英語版(原文) を参照してください。
Package org.opencv.dnn
クラス Model
- java.lang.Object
-
- org.opencv.dnn.Model
-
- 既知の直接サブクラス:
ClassificationModel,DetectionModel,KeypointsModel,SegmentationModel,TextDetectionModel,TextRecognitionModel
public class Model extends java.lang.ObjectThis class is presented high-level API for neural networks. Model allows to set params for preprocessing input image. Model creates net from file with trained weights and config, sets preprocessing input and runs forward pass.
-
-
フィールドの要約
フィールド Modifier and Type Field Description protected longnativeObj
-
コンストラクタの要約
コンストラクタ Modifier Constructor Description protectedModel​(long addr)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.Model​(Net network)Create model from deep learning network.
-
メソッドの要約
すべてのメソッド 静的メソッド インスタンスメソッド 具象メソッド Modifier and Type Method Description static Model__fromPtr__​(long addr)ModelenableWinograd​(boolean useWinograd)longgetNativeObjAddr()voidpredict​(Mat frame, java.util.List<Mat> outs)Given theinputframe, create input blob, run net and return the outputblobs.ModelsetInputCrop​(boolean crop)Set flag crop for frame.ModelsetInputMean​(Scalar mean)Set mean value for frame.voidsetInputParams()Set preprocessing parameters for frame.voidsetInputParams​(double scale)Set preprocessing parameters for frame.voidsetInputParams​(double scale, Size size)Set preprocessing parameters for frame.voidsetInputParams​(double scale, Size size, Scalar mean)Set preprocessing parameters for frame.voidsetInputParams​(double scale, Size size, Scalar mean, boolean swapRB)Set preprocessing parameters for frame.voidsetInputParams​(double scale, Size size, Scalar mean, boolean swapRB, boolean crop)Set preprocessing parameters for frame.ModelsetInputScale​(Scalar scale)Set scalefactor value for frame.ModelsetInputSize​(int width, int height)ModelsetInputSize​(Size size)Set input size for frame.ModelsetInputSwapRB​(boolean swapRB)Set flag swapRB for frame.ModelsetOutputNames​(java.util.List<java.lang.String> outNames)Set output names for frame.ModelsetPreferableBackend​(int backendId)ModelsetPreferableTarget​(int targetId)
-
-
-
コンストラクタの詳細
-
Model
protected Model​(long addr)
-
Model
public Model​(java.lang.String model, java.lang.String config)Create model from deep learning network represented in one of the supported formats. An order ofmodelandconfigarguments does not matter.- 引数:
model- 学習済み重みを含むバイナリファイル。config- ネットワーク構成を含むテキストファイル。
-
Model
public Model​(java.lang.String model)
Create model from deep learning network represented in one of the supported formats. An order ofmodelandconfigarguments does not matter.- 引数:
model- 学習済み重みを含むバイナリファイル。
-
Model
public Model​(Net network)
Create model from deep learning network.- 引数:
network- Net オブジェクト。
-
-
メソッドの詳細
-
getNativeObjAddr
public long getNativeObjAddr()
-
__fromPtr__
public static Model __fromPtr__​(long addr)
-
setInputSize
public Model setInputSize​(Size size)
Set input size for frame.- 引数:
size- 新しい入力サイズ。 覚え書き: 新しいblobの形状が0未満の場合、フレームサイズは変更されない。- 戻り値:
- 自動生成
-
setInputSize
public Model setInputSize​(int width, int height)
- 引数:
width- 新しい入力幅。height- 新しい入力高さ。- 戻り値:
- 自動生成
-
setInputMean
public Model setInputMean​(Scalar mean)
Set mean value for frame.- 引数:
mean- 各チャンネルから減算される平均値を持つScalar。- 戻り値:
- 自動生成
-
setInputScale
public Model setInputScale​(Scalar scale)
Set scalefactor value for frame.- 引数:
scale- フレーム値に対する乗数。- 戻り値:
- 自動生成
-
setInputCrop
public Model setInputCrop​(boolean crop)
Set flag crop for frame.- 引数:
crop- リサイズ後に画像を切り抜くかどうかを示すフラグ。- 戻り値:
- 自動生成
-
setInputSwapRB
public Model setInputSwapRB​(boolean swapRB)
Set flag swapRB for frame.- 引数:
swapRB- 最初と最後のチャンネルを入れ替えることを示すフラグ。- 戻り値:
- 自動生成
-
setOutputNames
public Model setOutputNames​(java.util.List<java.lang.String> outNames)
Set output names for frame.- 引数:
outNames- 出力レイヤの名前。- 戻り値:
- 自動生成
-
setInputParams
public void setInputParams​(double scale, Size size, Scalar mean, boolean swapRB, boolean crop)Set preprocessing parameters for frame.- 引数:
size- 新しい入力サイズ。mean- 各チャンネルから減算される平均値を持つScalar。scale- フレーム値に対する乗数。swapRB- 最初と最後のチャンネルを入れ替えることを示すフラグ。crop- リサイズ後に画像を切り抜くかどうかを示すフラグ。 blob(n, c, y, x) = scale * resize( frame(y, x, c) ) - mean(c) )
-
setInputParams
public void setInputParams​(double scale, Size size, Scalar mean, boolean swapRB)Set preprocessing parameters for frame.- 引数:
size- 新しい入力サイズ。mean- 各チャンネルから減算される平均値を持つScalar。scale- フレーム値に対する乗数。swapRB- 最初と最後のチャンネルを入れ替えることを示すフラグ。 blob(n, c, y, x) = scale * resize( frame(y, x, c) ) - mean(c) )
-
setInputParams
public void setInputParams​(double scale, Size size, Scalar mean)Set preprocessing parameters for frame.- 引数:
size- 新しい入力サイズ。mean- 各チャンネルから減算される平均値を持つScalar。scale- フレーム値に対する乗数。 blob(n, c, y, x) = scale * resize( frame(y, x, c) ) - mean(c) )
-
setInputParams
public void setInputParams​(double scale, Size size)Set preprocessing parameters for frame.- 引数:
size- 新しい入力サイズ。scale- フレーム値に対する乗数。 blob(n, c, y, x) = scale * resize( frame(y, x, c) ) - mean(c) )
-
setInputParams
public void setInputParams​(double scale)
Set preprocessing parameters for frame.- 引数:
scale- フレーム値に対する乗数。 blob(n, c, y, x) = scale * resize( frame(y, x, c) ) - mean(c) )
-
setInputParams
public void setInputParams()
Set preprocessing parameters for frame. blob(n, c, y, x) = scale * resize( frame(y, x, c) ) - mean(c) )
-
predict
public void predict​(Mat frame, java.util.List<Mat> outs)
Given theinputframe, create input blob, run net and return the outputblobs.- 引数:
outs- 確保された出力blob。計算結果を格納する。frame- 自動生成
-
setPreferableBackend
public Model setPreferableBackend​(int backendId)
-
setPreferableTarget
public Model setPreferableTarget​(int targetId)
-
enableWinograd
public Model enableWinograd​(boolean useWinograd)
-
-