metadata:
  name: openvino-omz-semantic-segmentation-adas-0001
  namespace: cvat
  annotations:
    name: Semantic segmentation for ADAS
    type: detector
    framework: openvino
    spec: |
      [
        { "id": 0, "name": "road" },
        { "id": 1, "name": "sidewalk" },
        { "id": 2, "name": "building" },
        { "id": 3, "name": "wall" },
        { "id": 4, "name": "fence" },
        { "id": 5, "name": "pole" },
        { "id": 6, "name": "traffic light" },
        { "id": 7, "name": "traffic sign" },
        { "id": 8, "name": "vegetation" },
        { "id": 9, "name": "terrain" },
        { "id": 10, "name": "sky" },
        { "id": 11, "name": "person" },
        { "id": 12, "name": "rider" },
        { "id": 13, "name": "car" },
        { "id": 14, "name": "truck" },
        { "id": 15, "name": "bus" },
        { "id": 16, "name": "train" },
        { "id": 17, "name": "motorcycle" },
        { "id": 18, "name": "bicycle" },
        { "id": 19, "name": "ego-vehicle" },
        { "id": 20, "name": "background" }
      ]

spec:
  description: Segmentation network to classify each pixel into typical 20 classes for ADAS
  runtime: 'python:3.6'
  handler: main:handler
  eventTimeout: 30s
  env:
    - name: NUCLIO_PYTHON_EXE_PATH
      value: /opt/nuclio/common/python3

  build:
    image: cvat/openvino.omz.intel.semantic-segmentation-adas-0001
    baseImage: openvino/ubuntu18_dev:2020.2

    directives:
      preCopy:
        - kind: USER
          value: root
        - kind: WORKDIR
          value: /opt/nuclio
        - kind: RUN
          value: ln -s /usr/bin/pip3 /usr/bin/pip
        - kind: RUN
          value: /opt/intel/openvino/deployment_tools/open_model_zoo/tools/downloader/downloader.py --name semantic-segmentation-adas-0001 -o /opt/nuclio/open_model_zoo

      postCopy:
        - kind: RUN
          value: apt update && DEBIAN_FRONTEND=noninteractive apt install --no-install-recommends -y python3-skimage
        - kind: RUN
          value: pip3 install "numpy<1.16.0" # workaround for skimage

  triggers:
    myHttpTrigger:
      maxWorkers: 2
      kind: 'http'
      workerAvailabilityTimeoutMilliseconds: 10000
      attributes:
        maxRequestBodySize: 33554432 # 32MB

  platform:
    attributes:
      restartPolicy:
        name: always
        maximumRetryCount: 3
