apiVersion: v1
kind: Pod
metadata:
  name: rfcn-fp32-inference # {"$openapi":"MODEL_NAME"}
spec:
  serviceAccountName: rfcn-fp32-inference # {"$openapi":"MODEL_NAME"}
  securityContext:
    runAsUser: 0 # {"$openapi":"USER_ID"}
    runAsGroup: 0 # {"$openapi":"GROUP_ID"}
    fsGroup: 0 # {"$openapi":"FS_ID"}
  initContainers:
  - name: extract-pretrained-model
    image: docker.io/intel/object-detection:tf-latest-rfcn-fp32-inference # {"$openapi":"IMAGE"}
    imagePullPolicy: IfNotPresent
    workingDir: /workspace/rfcn-fp32-inference # {"$openapi":"MODEL_DIR"}
    command:
    - bash
    - -c
    args:
    - mkdir -p $(PRETRAINED_MODEL_DIR);
      find $(PRETRAINED_MODEL_DIR) -type d -exec chmod 777 {} \;;
      tar -C $(PRETRAINED_MODEL_DIR) -xvf pretrained_model/rfcn_fp32_model.tar.gz;
    envFrom:
    - configMapRef:
        name: rfcn-fp32-inference # {"$openapi":"MODEL_NAME"}
    volumeMounts:
    - name: nfs-path
      mountPath: /nfs # {"$openapi":"NFS_PATH"}
  containers:
  - name: serving
    image: docker.io/intel/object-detection:tf-latest-rfcn-fp32-inference # {"$openapi":"IMAGE"}
    workingDir: /workspace/rfcn-fp32-inference # {"$openapi":"MODEL_DIR"}
    command:
    - python
    args: # {"$openapi":"COMMAND"}
    - /workspace/rfcn-fp32-inference/benchmarks/launch_benchmark.py # {"$openapi":"COMMAND"}
    - --model-name
    - rfcn
    - --mode
    - inference
    - --precision
    - fp32
    - --framework
    - tensorflow
    - --model-source-dir
    - /tensorflow/models
    - --data-location
    - $(VAL_IMAGE_DIR)
    - --in-graph
    - $(FROZEN_GRAPH)
    - --output-dir
    - $(OUTPUT_DIR)
    - --batch-size
    - "1"
    - --benchmark-only
    - --
    - number_of_steps=500
    envFrom:
    - configMapRef:
        name: rfcn-fp32-inference # {"$openapi":"MODEL_NAME"}
    volumeMounts:
    - name: datasets
      mountPath: /datasets # {"$openapi":"DATASET_DIR"}
      readOnly: true
    - name: nfs-path
      mountPath: /nfs # {"$openapi":"NFS_PATH"}
  volumes:
  - name: datasets
    hostPath:
      path: /datasets # {"$openapi":"DATASET_DIR"}
  - name: nfs-path
    nfs:
      server: 0.0.0.0 # {"$openapi":"NFS_SERVER"}
      path: /nfs # {"$openapi":"NFS_PATH"}
  restartPolicy: OnFailure
