Connect an OCR model

P4 Search uses Tesseract and ImageMagick by default for optical character recognition (OCR). See Install Tesseract and ImageMagick (OCR). Alternatively, you can connect and configure an external OCR model. You can only connect one OCR model at a time.

You must agree to P4 Search's terms to access a third-party service in P4 Search. See Bring your own key for P4 Search.

To learn more about setting configurations manually, see Configure P4 Search locally.

Set up auto-OCR with Azure OCR

  1. Set the auto-ocr model to AzureOcrModel:

  2. com.perforce.p4search.auto-ocr.model=AzureOcrModel

  3. Specify the auto-tagging service hostname. For example:

  4. com.perforce.p4search.auto-detect.host=https://my.cognitiveservices.azure.com

  5. Specify the language you want the image tags to be generated in, see your auto-tagging service documentation for supported languages. For example:

  6. com.perforce.p4search.auto-detect.lang=en

  7. Enter the API key for your auto-tagging service. For example:

  8. com.perforce.p4search.auto-detect.key=0123456789ABCDEF0123456789ABCDEF

Copy
All configurables:
com.perforce.p4search.auto-ocr.model=AzureOcrModel
com.perforce.p4search.auto-detect.host=https://my.cognitiveservices.azure.com
com.perforce.p4search.auto-detect.lang=en
com.perforce.p4search.auto-detect.key=0123456789ABCDEF0123456789ABCDEF

Set up auto-OCR with Rekognition OCR

  1. Set the auto-ocr model to RekognitionOcrModel, for example:

  2. com.perforce.p4search.auto-ocr.model=RekognitionOcrModel

  3. Specify the auto-tagging service region as host. For example:

  4. com.perforce.p4search.auto-detect.host=us-east-2

  5. Specify the language you want the image tags to be generated in. See your auto-tagging service documentation for supported languages. For example:

  6. com.perforce.p4search.auto-detect.lang=en

  7. Enter the API key for your auto-tagging service. The API key for the RekognitionOcrModel is a combination of <aws_access_key_id> and <aws_secret_access_key>. For example:

  8. com.perforce.p4search.auto-detect.key=<aws_access_key_id>:<aws_secret_access_key>

    where

    ws_access_key_id=ABCDEFGHIJKL12345678

    ws_secret_access_key=ab0cd1ef2gh3IJ4aaaBBBcccWWW111rfc1234YERTpp

    gives

    com.perforce.p4search.auto-detect.key=ABCDEFGHIJKL12345678:ab0cd1ef2gh3IJ4aaaBBBcccWWW111rfc1234YERTpp

Copy
All configurables:
com.perforce.p4search.auto-ocr.model=RekognitionOcrModel
com.perforce.p4search.auto-detect.host=us-east-2
com.perforce.p4search.auto-detect.lang=en
com.perforce.p4search.auto-detect.key=ABCDEFGHIJKL12345678:ab0cd1ef2gh3IJ4aaaBBBcccWWW111rfc1234YERTpp

Set up auto-OCR with Google OCR

  1. Set the auto-ocr model to GoogleOcrModel:

  2. com.perforce.p4search.auto-ocr.model=GoogleOcrModel

  3. Specify the auto-tagging service hostname. For example:

  4. com.perforce.p4search.auto-detect.host=https://vision.googleapis.com

  5. Specify the language you want the image tags to be generated in. See your auto-tagging service documentation for supported languages. For example:

  6. com.perforce.p4search.auto-detect.lang=en

  7. Enter the API key for your auto-tagging service. For example:

  8. com.perforce.p4search.auto-detect.key=AbcdEFG12345ZXvfe56210QWErtyui123456789

Copy
All configurables:
com.perforce.p4search.auto-ocr.model=GoogleOcrModel
com.perforce.p4search.auto-detect.host=https://vision.googleapis.com
com.perforce.p4search.auto-detect.lang=en
com.perforce.p4search.auto-detect.key=AbcdEFG12345ZXvfe56210QWErtyui123456789