---
apiVersion: batch/v1
kind: Job
metadata:
  name: batch-predict-object-detection
spec:
  template:
    spec:
      containers:
      - name: batch-predict-object-detection
        image: gcr.io/kubeflow-examples/batch-predict:tf18-gpu
        imagePullPolicy: Always
        args:
          - "--input_file_pattern=gs://kubeflow-examples-data/object-detection-coco/data/object-detection-images.tfrecord"
          - "--input_file_format=tfrecord"
          - "--model_dir=gs://kubeflow-examples-data/object-detection-coco/image_string_model/saved_model"
          - "--batch_size=4"
          - "--output_result_prefix=gs://<your_gcs_bucket>/<your_detection_result_file_name_prefix>"
          - "--output_error_prefix=gs://<your_gcs_bucket>/<your_detection_error_file_name_prefix>"
        env:
          - name: "GOOGLE_APPLICATION_CREDENTIALS"
            value: "/secret/gcp-credentials/key.json"
        volumeMounts:
          - name: gcp-credentials
            readOnly: True
            mountPath: /secret/gcp-credentials
        resources:
            limits:
              nvidia.com/gpu: 1
      restartPolicy: Never
      volumes:
          - name: gcp-credentials
            secret:
              secretName: user-gcp-sa

  backoffLimit: 1
