Install P4 Detect

P4 Detect is a Python-based REST service that provides an API for image detection using OpenAI's CLIP model. Using P4 Detect with P4 Search is optional.

After you have installed P4 Detect, you can configure it. See Configure P4 Detect.

Before you begin

Install P4 Detect

P4 Detect is provided as a P4 Detect Docker image.

To launch P4 Detect with Docker, run the following Docker commands on your local host:

  1. Fetch the P4 Detect Docker container:

    docker pull perforce/p4detect:latest

  2. Run the P4 Detect service with or without mounting the default volumes. Mounting the default volumes allows you to choose your own image tagging labels.

    • Run without mounting the default volumes:

      docker run -d --name p4detect.helix -p 1608:1608 perforce/p4detect:latest

      where p4detect.helix is the name of the running container.

    • Run with mounting the default volumes:

      Choose a location to create mount points and run the following:

      mkdir -p volumes/tagging/config
      mkdir -p volumes/tagging/label_config
      mkdir -p volumes/tagging/logs
      
      docker run  -d \
          -u $(id -u):$(id -g) \
          --name p4detect.helix \
          -p 1608:1608 \
          -v ./volumes/p4detect/config:/config \
          -v ./volumes/p4detect/label_config:/label_config \
          -v ./volumes/p4detect/logs:/logs \
          -e WORKERS=1 \
          -e HF_HOME=/config/hf_cache \
          -e CONFIG_ENV=production \
          -e CONFIG_PATH=/config/config.yml \
          -e LABEL_CONFIG_PATH=/label_config \
          -e LOGGING_PATH=/logs/P4Detect.log \
          perforce/p4detect:latest

      where p4detect.helix is the name of the running container.

  3. (Optional:) Configure P4 Detect.

  4. Verify the installation. Replace <your-host> with your host:

    http://<your-host>:1608/healthy

Do not expose P4 Detect to the public internet.

Next steps