Connect an image tagging model

Follow these instructions to connect and configure an image tagging model for P4 Search.

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

Set up auto-tagging with Azure Tags

  1. Set the auto-tagging model to AzureTagsModel:

  2. com.perforce.p4search.auto-detect.model=AzureTagsModel

  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

  9. Specify the automatic image detection threshold for your auto-tagging service as a floating point percentage. For example, 0.1=10%:

  10. com.perforce.p4search.auto-detect.threshold=0.1

  11. Specify the automatic best image detection results limit. Defaults to 10 results:

  12. com.perforce.p4search.auto-detect.best=10

All the configurations together:

com.perforce.p4search.auto-detect.model=AzureTagsModel

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

com.perforce.p4search.auto-detect.threshold=0.1

com.perforce.p4search.auto-detect.best=10

Set up auto-tagging with Rekognition Labels

  1. Set the auto-tagging model to RekognitionLabelsModel:

  2. com.perforce.p4search.auto-detect.model=RekognitionLabelsModel

  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 AWS Rekognition 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

  9. Specify the automatic image detection threshold for your auto-tagging service as a floating point percentage. For example, 0.1=10%:

  10. com.perforce.p4search.auto-detect.threshold=0.1

  11. Specify the automatic best image detection results limit. Defaults to 10 results:

  12. com.perforce.p4search.auto-detect.best=10

All the configurations together:

com.perforce.p4search.auto-detect.model=RekognitionLabelsModel

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

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

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

com.perforce.p4search.auto-detect.threshold=0.1

com.perforce.p4search.auto-detect.best=10

Set up auto-tagging with Google Labels

  1. Set the auto-tagging model to GoogleLabelModel:

  2. com.perforce.p4search.auto-detect.model=GoogleLabelModel

  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

  9. Specify the automatic image detection threshold for your auto-tagging service as a floating point percentage. For example, 0.1=10%:

  10. com.perforce.p4search.auto-detect.threshold=0.1

  11. Specify the automatic best image detection results limit. Defaults to 10 results:

  12. com.perforce.p4search.auto-detect.best=10

All the configurations together:

com.perforce.p4search.auto-detect.model=GoogleLabelModel

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

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

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

com.perforce.p4search.auto-detect.threshold=0.1

com.perforce.p4search.auto-detect.best=10

Set up auto-tagging with DeepDetect

  1. Set the auto-tagging model to DeepDetectModel:

  2. com.perforce.p4search.auto-detect.model=DeepDetectModel

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

  4. com.perforce.p4search.auto-detect.host=https://localhost:8888

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

    DeepDetect does not support multiple languages. Leave empty for DeepDetect:

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

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

    DeepDetect does not support an API key. Default is empty:

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

  9. Specify the automatic image detection threshold for your auto-tagging service as a floating point percentage. For example, 0.1=10%:

  10. com.perforce.p4search.auto-detect.threshold=0.1

  11. Specify the automatic best image detection results limit. Defaults to 10 results:

  12. com.perforce.p4search.auto-detect.best=10

  13. Specify the classification service you want to use for image tags. For example, classification_21k if you are using the DeepDetect 21k pre-trained model:
  14. com.perforce.p4search.auto-detect.service=classification_21k

All the configurations together:

com.perforce.p4search.auto-detect.model=DeepDetectModel

com.perforce.p4search.auto-detect.host=http://localhost:8888

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

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

com.perforce.p4search.auto-detect.threshold=0.1

com.perforce.p4search.auto-detect.best=10

com.perforce.p4search.auto-detect.service=classification_21k

To learn more about using a pretrained model, see DeepDetect's Setup of an image classifier.

Example curl request to load the DeepDetect 21k pretrained model:

curl -H "Content-Type: application/x-www-form-urlencoded" -X PUT
 -d '{
 "description": "generic image classification service",
 "model": {
  "repository": "/opt/models/classification_21k",
  "init":"https://deepdetect.com/models/init/desktop/images/classification/classification_21k.tar.gz",
  "create_repository": true
 },
 "mllib": "caffe",
 "type": "supervised",
 "parameters": {
  "input": {
  "connector": "image"
  }
 }
}' http://localhost:8888/services/classification_21k