🤖 AIによる機械翻訳(非公式) — これは OpenCV 4.13.0 公式リファレンス(英語)を AI (Claude) で自動翻訳したものです。訳に誤りを含む場合があります。正確な情報は 公式英語版(原文) を参照してください。

クラス TextRecognitionModel


  • public class TextRecognitionModel extends Model
    このクラスはテキスト認識ネットワークの高レベルAPIを表す。TextRecognitionModelは入力画像の前処理に関する引数を設定できる。TextRecognitionModelは学習済み重みと設定を含むファイルからネットを生成し、入力の前処理を設定し、順伝播を実行して認識結果を返す。TextRecognitionModelではCRNN-CTCがサポートされている。
    • コンストラクタの詳細

      • TextRecognitionModel

        protected TextRecognitionModel​(long addr)
      • TextRecognitionModel

        public TextRecognitionModel​(Net network)
        Create Text Recognition model from deep learning network Call setDecodeType() and setVocabulary() after constructor to initialize the decoding method
        引数:
        network - Netオブジェクト
      • TextRecognitionModel

        public TextRecognitionModel​(java.lang.String model,
                                    java.lang.String config)
        Create text recognition model from network represented in one of the supported formats Call setDecodeType() and setVocabulary() after constructor to initialize the decoding method
        引数:
        model - 学習済み重みを含むバイナリファイル
        config - ネットワーク設定を含むテキストファイル
      • TextRecognitionModel

        public TextRecognitionModel​(java.lang.String model)
        Create text recognition model from network represented in one of the supported formats Call setDecodeType() and setVocabulary() after constructor to initialize the decoding method
        引数:
        model - 学習済み重みを含むバイナリファイル
    • メソッドの詳細

      • setDecodeType

        public TextRecognitionModel setDecodeType​(java.lang.String decodeType)
        Set the decoding method of translating the network output into string
        引数:
        decodeType - ネットワーク出力を文字列に変換するデコード方式。現在サポートされている型: - "CTC-greedy" CTCベース手法の出力に対するgreedyデコード - "CTC-prefix-beam-search" CTCベース手法の出力に対するPrefix beam searchデコード
        戻り値:
        自動生成
      • getDecodeType

        public java.lang.String getDecodeType()
        Get the decoding method
        戻り値:
        デコード方式
      • setDecodeOptsCTCPrefixBeamSearch

        public TextRecognitionModel setDecodeOptsCTCPrefixBeamSearch​(int beamSize,
                                                                     int vocPruneSize)
        Set the decoding method options for "CTC-prefix-beam-search" decode usage
        引数:
        beamSize - 探索のビームサイズ
        vocPruneSize - 大規模な語彙探索を最適化するための引数。各探索ステップで上位vocPruneSize個のトークンのみを対象とする。vocPruneSize <= 0 の場合はこのプルーニングを無効にする。
        戻り値:
        自動生成
      • setDecodeOptsCTCPrefixBeamSearch

        public TextRecognitionModel setDecodeOptsCTCPrefixBeamSearch​(int beamSize)
        Set the decoding method options for "CTC-prefix-beam-search" decode usage
        引数:
        beamSize - 探索のビームサイズ。各探索ステップで上位vocPruneSize個のトークンのみを対象とする。vocPruneSize <= 0 の場合はこのプルーニングを無効にする。
        戻り値:
        自動生成
      • setVocabulary

        public TextRecognitionModel setVocabulary​(java.util.List<java.lang.String> vocabulary)
        Set the vocabulary for recognition.
        引数:
        vocabulary - ネットワークに対応する語彙。
        戻り値:
        自動生成
      • getVocabulary

        public java.util.List<java.lang.String> getVocabulary()
        Get the vocabulary for recognition.
        戻り値:
        vocabulary 関連付けられた語彙
      • recognize

        public java.lang.String recognize​(Mat frame)
        Given the input frame, create input blob, run net and return recognition result
        引数:
        frame - 入力画像
        戻り値:
        テキスト認識結果
      • recognize

        public void recognize​(Mat frame,
                              java.util.List<Mat> roiRects,
                              java.util.List<java.lang.String> results)
        Given the input frame, create input blob, run net and return recognition result
        引数:
        frame - 入力画像
        roiRects - テキスト検出の関心領域のリスト(cv::Rect, CV_32SC4)。ROIはネットワーク入力として切り出される。
        results - テキスト認識結果の集合。