From f06ee388fe494b9db532fed0c0d89bb085955dba Mon Sep 17 00:00:00 2001 From: Roman Donchenko Date: Wed, 10 May 2023 02:04:50 +0400 Subject: [PATCH 01/11] serverless/deploy_cpu.sh: work correctly when nuctl defaults to the kube platform --- serverless/deploy_cpu.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/serverless/deploy_cpu.sh b/serverless/deploy_cpu.sh index 4a88158f88c..6410c33a047 100755 --- a/serverless/deploy_cpu.sh +++ b/serverless/deploy_cpu.sh @@ -4,7 +4,7 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" FUNCTIONS_DIR=${1:-$SCRIPT_DIR} -nuctl create project cvat +nuctl create project cvat --platform local shopt -s globstar @@ -17,6 +17,4 @@ do --platform local done -nuctl get function - - +nuctl get function --platform local From fe31d61835077a03f270625e9d165a6dcce3cf3d Mon Sep 17 00:00:00 2001 From: Roman Donchenko Date: Wed, 10 May 2023 02:12:13 +0400 Subject: [PATCH 02/11] serverless/deploy_cpu.sh: add proper shell quoting --- serverless/deploy_cpu.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/serverless/deploy_cpu.sh b/serverless/deploy_cpu.sh index 6410c33a047..9f638f34474 100755 --- a/serverless/deploy_cpu.sh +++ b/serverless/deploy_cpu.sh @@ -10,8 +10,8 @@ shopt -s globstar for func_config in "$FUNCTIONS_DIR"/**/function.yaml do - func_root=$(dirname "$func_config") - echo Deploying $(dirname "$func_root") function... + func_root="$(dirname "$func_config")" + echo "Deploying $(dirname "$func_root") function..." nuctl deploy --project-name cvat --path "$func_root" \ --volume "$SCRIPT_DIR/common:/opt/nuclio/common" \ --platform local From 1687e75b29611704121aa90195696ea47ca0ef6a Mon Sep 17 00:00:00 2001 From: Roman Donchenko Date: Wed, 10 May 2023 02:15:10 +0400 Subject: [PATCH 03/11] Modernize OpenVINO-based Nuclio functions and allow them to run on Kubernetes Currently, OpenVINO-based functions assume that a local directory will be mounted into the container. In Kubernetes, that isn't possible, so implement an alternate approach: create a separate base image and inherit the function image from it. In addition, implement some modernizations: * Upgrade the version of OpenVINO to the latest (2022.3). Make the necessary updates to the code. Note that 2022.1 introduced an entirely new inference API, but I haven't switched to it yet to minimize changes. * Use the runtime version of the Docker image as the base instead of the dev version. This significantly reduces the size of the final image (by ~3GB). * Replace the `faster_rcnn_inception_v2_coco` model with `faster_rcnn_inception_resnet_v2_atrous_coco`, as the former has been removed from OMZ. * Ditto with `person-reidentification-retail-0300` -> `0277`. * The IRs used in the DEXTR function are not supported by OpenVINO anymore (format too old), so rewrite the build process to create them from the original code/weights instead. --- serverless/common/openvino/python3 | 7 --- serverless/deploy_cpu.sh | 14 +++-- serverless/openvino/base/Dockerfile | 15 +++++ .../base}/model_loader.py | 16 +++-- .../openvino => openvino/base}/shared.py | 0 serverless/openvino/dextr/nuclio/Dockerfile | 32 ++++++++++ .../openvino/dextr/nuclio/adaptive-pool.patch | 27 +++++++++ serverless/openvino/dextr/nuclio/export.py | 26 ++++++++ .../openvino/dextr/nuclio/function.yaml | 36 +---------- .../face-detection-0205/nuclio/Dockerfile | 11 ++++ .../face-detection-0205/nuclio/function.yaml | 38 +----------- .../nuclio/Dockerfile | 17 ++++++ .../nuclio/function.yaml | 33 +++++++++++ .../nuclio/main.py | 2 +- .../nuclio/model_handler.py | 6 +- .../nuclio/function.yaml | 59 ------------------- .../nuclio/Dockerfile | 11 ++++ .../nuclio/function.yaml | 34 +---------- .../text-detection-0004/nuclio/Dockerfile | 11 ++++ .../text-detection-0004/nuclio/function.yaml | 28 +-------- .../nuclio/Dockerfile | 17 ++++++ .../nuclio/function.yaml | 36 ++--------- .../nuclio/main.py | 2 +- .../nuclio/model_handler.py | 6 +- .../nuclio/Dockerfile | 23 ++++++++ .../nuclio/function.yaml | 36 +---------- .../omz/public/yolo-v3-tf/nuclio/Dockerfile | 17 ++++++ .../public/yolo-v3-tf/nuclio/function.yaml | 32 +--------- .../public/yolo-v3-tf/nuclio/model_handler.py | 37 ++++++++---- 29 files changed, 310 insertions(+), 319 deletions(-) delete mode 100755 serverless/common/openvino/python3 create mode 100644 serverless/openvino/base/Dockerfile rename serverless/{common/openvino => openvino/base}/model_loader.py (82%) rename serverless/{common/openvino => openvino/base}/shared.py (100%) create mode 100644 serverless/openvino/dextr/nuclio/Dockerfile create mode 100644 serverless/openvino/dextr/nuclio/adaptive-pool.patch create mode 100644 serverless/openvino/dextr/nuclio/export.py create mode 100644 serverless/openvino/omz/intel/face-detection-0205/nuclio/Dockerfile create mode 100644 serverless/openvino/omz/intel/person-reidentification-retail-0277/nuclio/Dockerfile create mode 100644 serverless/openvino/omz/intel/person-reidentification-retail-0277/nuclio/function.yaml rename serverless/openvino/omz/intel/{person-reidentification-retail-300 => person-reidentification-retail-0277}/nuclio/main.py (93%) rename serverless/openvino/omz/intel/{person-reidentification-retail-300 => person-reidentification-retail-0277}/nuclio/model_handler.py (97%) delete mode 100644 serverless/openvino/omz/intel/person-reidentification-retail-300/nuclio/function.yaml create mode 100644 serverless/openvino/omz/intel/semantic-segmentation-adas-0001/nuclio/Dockerfile create mode 100644 serverless/openvino/omz/intel/text-detection-0004/nuclio/Dockerfile create mode 100644 serverless/openvino/omz/public/faster_rcnn_inception_resnet_v2_atrous_coco/nuclio/Dockerfile rename serverless/openvino/omz/public/{faster_rcnn_inception_v2_coco => faster_rcnn_inception_resnet_v2_atrous_coco}/nuclio/function.yaml (75%) rename serverless/openvino/omz/public/{faster_rcnn_inception_v2_coco => faster_rcnn_inception_resnet_v2_atrous_coco}/nuclio/main.py (92%) rename serverless/openvino/omz/public/{faster_rcnn_inception_v2_coco => faster_rcnn_inception_resnet_v2_atrous_coco}/nuclio/model_handler.py (93%) create mode 100644 serverless/openvino/omz/public/mask_rcnn_inception_resnet_v2_atrous_coco/nuclio/Dockerfile create mode 100644 serverless/openvino/omz/public/yolo-v3-tf/nuclio/Dockerfile diff --git a/serverless/common/openvino/python3 b/serverless/common/openvino/python3 deleted file mode 100755 index dfd05669c2b..00000000000 --- a/serverless/common/openvino/python3 +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -args=$@ - -. /opt/intel/openvino/bin/setupvars.sh -PYTHONPATH=/opt/nuclio/common/openvino:$PYTHONPATH -/usr/bin/python3 $args diff --git a/serverless/deploy_cpu.sh b/serverless/deploy_cpu.sh index 9f638f34474..ebb0a24726d 100755 --- a/serverless/deploy_cpu.sh +++ b/serverless/deploy_cpu.sh @@ -4,6 +4,8 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" FUNCTIONS_DIR=${1:-$SCRIPT_DIR} +docker build -t cvat.openvino.base "$SCRIPT_DIR/openvino/base" + nuctl create project cvat --platform local shopt -s globstar @@ -11,10 +13,14 @@ shopt -s globstar for func_config in "$FUNCTIONS_DIR"/**/function.yaml do func_root="$(dirname "$func_config")" - echo "Deploying $(dirname "$func_root") function..." - nuctl deploy --project-name cvat --path "$func_root" \ - --volume "$SCRIPT_DIR/common:/opt/nuclio/common" \ - --platform local + func_rel_path="$(realpath --relative-to="$SCRIPT_DIR" "$(dirname "$func_root")")" + + if [ -f "$func_root/Dockerfile" ]; then + docker build -t "cvat.${func_rel_path//\//.}.base" "$func_root" + fi + + echo "Deploying $func_rel_path function..." + nuctl deploy --project-name cvat --path "$func_root" --platform local done nuctl get function --platform local diff --git a/serverless/openvino/base/Dockerfile b/serverless/openvino/base/Dockerfile new file mode 100644 index 00000000000..3893f812880 --- /dev/null +++ b/serverless/openvino/base/Dockerfile @@ -0,0 +1,15 @@ +FROM openvino/ubuntu20_runtime:2022.3.0 + +USER root + +RUN apt-get update \ + && apt-get -y --no-install-recommends install python-is-python3 \ + && rm -rf /var/lib/apt/lists/* + +RUN pip install --no-cache-dir opencv-python-headless pillow pyyaml + +COPY model_loader.py shared.py /opt/nuclio/common/openvino/ + +ENV PYTHONPATH=/opt/nuclio/common/openvino:$PYTHONPATH + +USER openvino diff --git a/serverless/common/openvino/model_loader.py b/serverless/openvino/base/model_loader.py similarity index 82% rename from serverless/common/openvino/model_loader.py rename to serverless/openvino/base/model_loader.py index ffaf2975fe4..fb369a645a1 100644 --- a/serverless/common/openvino/model_loader.py +++ b/serverless/openvino/base/model_loader.py @@ -14,24 +14,22 @@ def __init__(self, model, weights): # Initialize input blobs self._input_info_name = None - for blob_name in network.inputs: - if len(network.inputs[blob_name].shape) == 4: + for blob_name in network.input_info: + if len(network.input_info[blob_name].tensor_desc.dims) == 4: self._input_blob_name = blob_name - elif len(network.inputs[blob_name].shape) == 2: + self._input_layout = network.input_info[blob_name].tensor_desc.dims + elif len(network.input_info[blob_name].tensor_desc.dims) == 2: self._input_info_name = blob_name else: raise RuntimeError( "Unsupported {}D input layer '{}'. Only 2D and 4D input layers are supported" - .format(len(network.inputs[blob_name].shape), blob_name)) + .format(len(network.input_info[blob_name].tensor_desc.dims), blob_name)) # Initialize output blob self._output_blob_name = next(iter(network.outputs)) # Load network self._net = ie_core.load_network(network, "CPU", num_requests=2) - input_type = network.inputs[self._input_blob_name] - self._input_layout = input_type if isinstance(input_type, list) else input_type.shape - def _prepare_inputs(self, image, preprocessing): image = np.array(image) @@ -67,5 +65,5 @@ def input_size(self): return self._input_layout[2:] @property - def layers(self): - return self._network.layers + def network(self): + return self._network diff --git a/serverless/common/openvino/shared.py b/serverless/openvino/base/shared.py similarity index 100% rename from serverless/common/openvino/shared.py rename to serverless/openvino/base/shared.py diff --git a/serverless/openvino/dextr/nuclio/Dockerfile b/serverless/openvino/dextr/nuclio/Dockerfile new file mode 100644 index 00000000000..589e231e099 --- /dev/null +++ b/serverless/openvino/dextr/nuclio/Dockerfile @@ -0,0 +1,32 @@ +FROM openvino/ubuntu20_dev:2022.3.0 AS build + +USER root + +RUN apt-get update \ + && apt-get -y --no-install-recommends install patch \ + && rm -rf /var/lib/apt/lists/* + +WORKDIR /root + +ARG DEXTR_COMMIT=352ccc76067156ebcf7267b07e0a5e43d32e83d5 + +# TODO: use `ADD --checksum` when that feature becomes stable +ADD https://data.vision.ee.ethz.ch/csergi/share/DEXTR/dextr_pascal-sbd.pth ./ + +ADD https://github.com/scaelles/DEXTR-PyTorch/archive/$DEXTR_COMMIT.zip dextr.zip + +RUN python3 -m zipfile -e dextr.zip . + +WORKDIR /root/DEXTR-PyTorch-$DEXTR_COMMIT + +ADD export.py adaptive-pool.patch . + +RUN patch -p1 -i adaptive-pool.patch + +RUN python3 export.py /root/dextr_pascal-sbd.pth /root/dextr.onnx + +RUN mo --input_model=/root/dextr.onnx --model_name=dextr --output_dir=/root + +FROM cvat.openvino.base + +COPY --from=build --chown=root:root /root/dextr.xml /root/dextr.bin /opt/nuclio/ diff --git a/serverless/openvino/dextr/nuclio/adaptive-pool.patch b/serverless/openvino/dextr/nuclio/adaptive-pool.patch new file mode 100644 index 00000000000..94ef2e7e6ce --- /dev/null +++ b/serverless/openvino/dextr/nuclio/adaptive-pool.patch @@ -0,0 +1,27 @@ +This is a hack to work around the the lack of support for AdaptiveAvgPool2d +in PyTorch's ONNX exporter (). + +It might become unnecessary in the future, since OpenVINO 2023 is to add support +for AdaptiveAvgPool2d exported with operator_export_type=ONNX_ATEN_FALLBACK +(). + +diff --git a/networks/deeplab_resnet.py b/networks/deeplab_resnet.py +index ecfa084..e8ff297 100644 +--- a/networks/deeplab_resnet.py ++++ b/networks/deeplab_resnet.py +@@ -99,7 +99,14 @@ class PSPModule(nn.Module): + self.final = nn.Conv2d(out_features, n_classes, kernel_size=1) + + def _make_stage_1(self, in_features, size): +- prior = nn.AdaptiveAvgPool2d(output_size=(size, size)) ++ kernel_size, stride = { ++ 1: (64, 64), ++ 2: (32, 32), ++ 3: (22, 21), ++ 6: (11, 9), ++ }[size] ++ ++ prior = nn.AvgPool2d(kernel_size=kernel_size, stride=stride) + conv = nn.Conv2d(in_features, in_features//4, kernel_size=1, bias=False) + bn = nn.BatchNorm2d(in_features//4, affine=affine_par) + relu = nn.ReLU(inplace=True) diff --git a/serverless/openvino/dextr/nuclio/export.py b/serverless/openvino/dextr/nuclio/export.py new file mode 100644 index 00000000000..e244db08558 --- /dev/null +++ b/serverless/openvino/dextr/nuclio/export.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python3 + +import sys + +import torch +import torch.nn +import torch.onnx + +import networks.deeplab_resnet as resnet + +net = resnet.resnet101(1, nInputChannels=4, classifier='psp') + +state_dict_checkpoint = torch.load(sys.argv[1], map_location=torch.device('cpu')) + +net.load_state_dict(state_dict_checkpoint) + +full_net = torch.nn.Sequential( + net, + torch.nn.Upsample((512, 512), mode='bilinear', align_corners=True), + torch.nn.Sigmoid(), +) +full_net.eval() + +input_tensor = torch.randn((1, 4, 512, 512)) + +torch.onnx.export(full_net, input_tensor, sys.argv[2]) diff --git a/serverless/openvino/dextr/nuclio/function.yaml b/serverless/openvino/dextr/nuclio/function.yaml index 0adeb064e34..3a1df59ad31 100644 --- a/serverless/openvino/dextr/nuclio/function.yaml +++ b/serverless/openvino/dextr/nuclio/function.yaml @@ -13,43 +13,13 @@ metadata: spec: description: Deep Extreme Cut - runtime: 'python:3.6' + runtime: 'python:3.8' handler: main:handler eventTimeout: 30s - env: - - name: NUCLIO_PYTHON_EXE_PATH - value: /opt/nuclio/common/openvino/python3 - - volumes: - - volume: - name: openvino-common - configMap: - name: "cvat-nuclio-openvino-common" - defaultMode: 0750 - volumeMount: - name: openvino-common - mountPath: /opt/nuclio/common/openvino build: - image: cvat/openvino.dextr - baseImage: openvino/ubuntu18_runtime:2020.2 - - directives: - preCopy: - - kind: USER - value: root - - kind: WORKDIR - value: /opt/nuclio - - kind: RUN - value: ln -s /usr/bin/pip3 /usr/bin/pip - - postCopy: - - kind: RUN - value: curl -O https://download.01.org/openvinotoolkit/models_contrib/cvat/dextr_model_v1.zip - - kind: RUN - value: unzip dextr_model_v1.zip - - kind: RUN - value: pip3 install -U pip && pip3 install wheel Pillow + image: cvat.openvino.dextr + baseImage: cvat.openvino.dextr.base triggers: myHttpTrigger: diff --git a/serverless/openvino/omz/intel/face-detection-0205/nuclio/Dockerfile b/serverless/openvino/omz/intel/face-detection-0205/nuclio/Dockerfile new file mode 100644 index 00000000000..b70dff4ffa2 --- /dev/null +++ b/serverless/openvino/omz/intel/face-detection-0205/nuclio/Dockerfile @@ -0,0 +1,11 @@ +FROM openvino/ubuntu20_dev:2022.3.0 AS build + +USER root + +RUN omz_downloader \ + --name face-detection-0205,emotions-recognition-retail-0003,age-gender-recognition-retail-0013 \ + -o /opt/nuclio/open_model_zoo + +FROM cvat.openvino.base + +COPY --from=build --chown=root:root /opt/nuclio/open_model_zoo /opt/nuclio/open_model_zoo diff --git a/serverless/openvino/omz/intel/face-detection-0205/nuclio/function.yaml b/serverless/openvino/omz/intel/face-detection-0205/nuclio/function.yaml index 79d5883a79f..5b9500699fe 100644 --- a/serverless/openvino/omz/intel/face-detection-0205/nuclio/function.yaml +++ b/serverless/openvino/omz/intel/face-detection-0205/nuclio/function.yaml @@ -28,47 +28,13 @@ metadata: spec: description: Detection network finding faces and defining age, gender and emotion attributes - runtime: 'python:3.6' + runtime: 'python:3.8' handler: main:handler eventTimeout: 30000s - env: - - name: NUCLIO_PYTHON_EXE_PATH - value: /opt/nuclio/common/openvino/python3 - - volumes: - - volume: - name: openvino-common - configMap: - name: "cvat-nuclio-openvino-common" - defaultMode: 0750 - volumeMount: - name: openvino-common - mountPath: /opt/nuclio/common/openvino build: image: cvat.openvino.omz.intel.face-detection-0205 - baseImage: openvino/ubuntu18_dev:2021.1 - - 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 face-detection-0205 -o /opt/nuclio/open_model_zoo - - kind: RUN - value: /opt/intel/openvino/deployment_tools/open_model_zoo/tools/downloader/downloader.py --name emotions-recognition-retail-0003 -o /opt/nuclio/open_model_zoo - - kind: RUN - value: /opt/intel/openvino/deployment_tools/open_model_zoo/tools/downloader/downloader.py --name age-gender-recognition-retail-0013 -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 + baseImage: cvat.openvino.omz.intel.face-detection-0205.base triggers: myHttpTrigger: diff --git a/serverless/openvino/omz/intel/person-reidentification-retail-0277/nuclio/Dockerfile b/serverless/openvino/omz/intel/person-reidentification-retail-0277/nuclio/Dockerfile new file mode 100644 index 00000000000..1791444f171 --- /dev/null +++ b/serverless/openvino/omz/intel/person-reidentification-retail-0277/nuclio/Dockerfile @@ -0,0 +1,17 @@ +FROM openvino/ubuntu20_dev:2022.3.0 AS build + +USER root + +RUN omz_downloader \ + --name person-reidentification-retail-0277 \ + -o /opt/nuclio/open_model_zoo + +FROM cvat.openvino.base + +USER root + +RUN pip install --no-cache-dir scipy + +COPY --from=build /opt/nuclio/open_model_zoo /opt/nuclio/open_model_zoo + +USER openvino diff --git a/serverless/openvino/omz/intel/person-reidentification-retail-0277/nuclio/function.yaml b/serverless/openvino/omz/intel/person-reidentification-retail-0277/nuclio/function.yaml new file mode 100644 index 00000000000..f3dbfa00300 --- /dev/null +++ b/serverless/openvino/omz/intel/person-reidentification-retail-0277/nuclio/function.yaml @@ -0,0 +1,33 @@ +metadata: + name: openvino-omz-intel-person-reidentification-retail-0277 + namespace: cvat + annotations: + name: Person reidentification + type: reid + framework: openvino + spec: + +spec: + description: Person reidentification model for a general scenario + runtime: 'python:3.8' + handler: main:handler + eventTimeout: 30s + + build: + image: cvat.openvino.omz.intel.person-reidentification-retail-0277 + baseImage: cvat.openvino.omz.intel.person-reidentification-retail-0277.base + + triggers: + myHttpTrigger: + maxWorkers: 2 + kind: 'http' + workerAvailabilityTimeoutMilliseconds: 10000 + attributes: + maxRequestBodySize: 33554432 # 32MB + + platform: + attributes: + restartPolicy: + name: always + maximumRetryCount: 3 + mountMode: volume diff --git a/serverless/openvino/omz/intel/person-reidentification-retail-300/nuclio/main.py b/serverless/openvino/omz/intel/person-reidentification-retail-0277/nuclio/main.py similarity index 93% rename from serverless/openvino/omz/intel/person-reidentification-retail-300/nuclio/main.py rename to serverless/openvino/omz/intel/person-reidentification-retail-0277/nuclio/main.py index ca159e63991..3ed43e06a68 100644 --- a/serverless/openvino/omz/intel/person-reidentification-retail-300/nuclio/main.py +++ b/serverless/openvino/omz/intel/person-reidentification-retail-0277/nuclio/main.py @@ -13,7 +13,7 @@ def init_context(context): context.logger.info("Init context...100%") def handler(context, event): - context.logger.info("Run person-reidentification-retail-0300 model") + context.logger.info("Run person-reidentification-retail-0277 model") data = event.body buf0 = io.BytesIO(base64.b64decode(data["image0"])) buf1 = io.BytesIO(base64.b64decode(data["image1"])) diff --git a/serverless/openvino/omz/intel/person-reidentification-retail-300/nuclio/model_handler.py b/serverless/openvino/omz/intel/person-reidentification-retail-0277/nuclio/model_handler.py similarity index 97% rename from serverless/openvino/omz/intel/person-reidentification-retail-300/nuclio/model_handler.py rename to serverless/openvino/omz/intel/person-reidentification-retail-0277/nuclio/model_handler.py index ca0be2704e3..fff370601b0 100644 --- a/serverless/openvino/omz/intel/person-reidentification-retail-300/nuclio/model_handler.py +++ b/serverless/openvino/omz/intel/person-reidentification-retail-0277/nuclio/model_handler.py @@ -13,9 +13,9 @@ class ModelHandler: def __init__(self): base_dir = os.path.abspath(os.environ.get("MODEL_PATH", - "/opt/nuclio/open_model_zoo/intel/person-reidentification-retail-0300/FP32")) - model_xml = os.path.join(base_dir, "person-reidentification-retail-0300.xml") - model_bin = os.path.join(base_dir, "person-reidentification-retail-0300.bin") + "/opt/nuclio/open_model_zoo/intel/person-reidentification-retail-0277/FP32")) + model_xml = os.path.join(base_dir, "person-reidentification-retail-0277.xml") + model_bin = os.path.join(base_dir, "person-reidentification-retail-0277.bin") self.model = ModelLoader(model_xml, model_bin) diff --git a/serverless/openvino/omz/intel/person-reidentification-retail-300/nuclio/function.yaml b/serverless/openvino/omz/intel/person-reidentification-retail-300/nuclio/function.yaml deleted file mode 100644 index 672a695c25f..00000000000 --- a/serverless/openvino/omz/intel/person-reidentification-retail-300/nuclio/function.yaml +++ /dev/null @@ -1,59 +0,0 @@ -metadata: - name: openvino-omz-intel-person-reidentification-retail-0300 - namespace: cvat - annotations: - name: Person reidentification - type: reid - framework: openvino - spec: - -spec: - description: Person reidentification model for a general scenario - runtime: 'python:3.6' - handler: main:handler - eventTimeout: 30s - env: - - name: NUCLIO_PYTHON_EXE_PATH - value: /opt/nuclio/common/openvino/python3 - - volumes: - - volume: - name: openvino-common - configMap: - name: "cvat-nuclio-openvino-common" - defaultMode: 0750 - volumeMount: - name: openvino-common - mountPath: /opt/nuclio/common/openvino - - build: - image: cvat.openvino.omz.intel.person-reidentification-retail-0300 - 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 person-reidentification-retail-0300 -o /opt/nuclio/open_model_zoo - - kind: RUN - value: /opt/intel/openvino/deployment_tools/open_model_zoo/tools/downloader/converter.py --name person-reidentification-retail-0300 --precisions FP32 -d /opt/nuclio/open_model_zoo -o /opt/nuclio/open_model_zoo - - triggers: - myHttpTrigger: - maxWorkers: 2 - kind: 'http' - workerAvailabilityTimeoutMilliseconds: 10000 - attributes: - maxRequestBodySize: 33554432 # 32MB - - platform: - attributes: - restartPolicy: - name: always - maximumRetryCount: 3 - mountMode: volume diff --git a/serverless/openvino/omz/intel/semantic-segmentation-adas-0001/nuclio/Dockerfile b/serverless/openvino/omz/intel/semantic-segmentation-adas-0001/nuclio/Dockerfile new file mode 100644 index 00000000000..6e9ec83c2d3 --- /dev/null +++ b/serverless/openvino/omz/intel/semantic-segmentation-adas-0001/nuclio/Dockerfile @@ -0,0 +1,11 @@ +FROM openvino/ubuntu20_dev:2022.3.0 AS build + +USER root + +RUN omz_downloader \ + --name semantic-segmentation-adas-0001 \ + -o /opt/nuclio/open_model_zoo + +FROM cvat.openvino.base + +COPY --from=build --chown=root:root /opt/nuclio/open_model_zoo /opt/nuclio/open_model_zoo diff --git a/serverless/openvino/omz/intel/semantic-segmentation-adas-0001/nuclio/function.yaml b/serverless/openvino/omz/intel/semantic-segmentation-adas-0001/nuclio/function.yaml index 375569044db..d87da0b8880 100644 --- a/serverless/openvino/omz/intel/semantic-segmentation-adas-0001/nuclio/function.yaml +++ b/serverless/openvino/omz/intel/semantic-segmentation-adas-0001/nuclio/function.yaml @@ -32,43 +32,13 @@ metadata: spec: description: Segmentation network to classify each pixel into typical 20 classes for ADAS - runtime: 'python:3.6' + runtime: 'python:3.8' handler: main:handler eventTimeout: 30s - env: - - name: NUCLIO_PYTHON_EXE_PATH - value: /opt/nuclio/common/openvino/python3 - - volumes: - - volume: - name: openvino-common - configMap: - name: "cvat-nuclio-openvino-common" - defaultMode: 0750 - volumeMount: - name: openvino-common - mountPath: /opt/nuclio/common/openvino 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 + baseImage: cvat.openvino.omz.intel.semantic-segmentation-adas-0001.base triggers: myHttpTrigger: diff --git a/serverless/openvino/omz/intel/text-detection-0004/nuclio/Dockerfile b/serverless/openvino/omz/intel/text-detection-0004/nuclio/Dockerfile new file mode 100644 index 00000000000..74818551e6f --- /dev/null +++ b/serverless/openvino/omz/intel/text-detection-0004/nuclio/Dockerfile @@ -0,0 +1,11 @@ +FROM openvino/ubuntu20_dev:2022.3.0 AS build + +USER root + +RUN omz_downloader \ + --name text-detection-0004 \ + -o /opt/nuclio/open_model_zoo + +FROM cvat.openvino.base + +COPY --from=build --chown=root:root /opt/nuclio/open_model_zoo /opt/nuclio/open_model_zoo diff --git a/serverless/openvino/omz/intel/text-detection-0004/nuclio/function.yaml b/serverless/openvino/omz/intel/text-detection-0004/nuclio/function.yaml index 8c2f226f786..65e750b31f5 100644 --- a/serverless/openvino/omz/intel/text-detection-0004/nuclio/function.yaml +++ b/serverless/openvino/omz/intel/text-detection-0004/nuclio/function.yaml @@ -12,37 +12,13 @@ metadata: spec: description: Text detector based on PixelLink architecture with MobileNetV2-like as a backbone for indoor/outdoor scenes. - runtime: 'python:3.6' + runtime: 'python:3.8' handler: main:handler eventTimeout: 30s - env: - - name: NUCLIO_PYTHON_EXE_PATH - value: /opt/nuclio/common/openvino/python3 - - volumes: - - volume: - name: openvino-common - configMap: - name: "cvat-nuclio-openvino-common" - defaultMode: 0750 - volumeMount: - name: openvino-common - mountPath: /opt/nuclio/common/openvino build: image: cvat.openvino.omz.intel.text-detection-0004 - 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 text-detection-0004 -o /opt/nuclio/open_model_zoo + baseImage: cvat.openvino.omz.intel.text-detection-0004.base triggers: myHttpTrigger: diff --git a/serverless/openvino/omz/public/faster_rcnn_inception_resnet_v2_atrous_coco/nuclio/Dockerfile b/serverless/openvino/omz/public/faster_rcnn_inception_resnet_v2_atrous_coco/nuclio/Dockerfile new file mode 100644 index 00000000000..088ce755e98 --- /dev/null +++ b/serverless/openvino/omz/public/faster_rcnn_inception_resnet_v2_atrous_coco/nuclio/Dockerfile @@ -0,0 +1,17 @@ +FROM openvino/ubuntu20_dev:2022.3.0 AS build + +USER root + +RUN omz_downloader \ + --name faster_rcnn_inception_resnet_v2_atrous_coco \ + -o /opt/nuclio/open_model_zoo.orig + +RUN omz_converter \ + --name faster_rcnn_inception_resnet_v2_atrous_coco \ + --precisions FP32 \ + -d /opt/nuclio/open_model_zoo.orig \ + -o /opt/nuclio/open_model_zoo + +FROM cvat.openvino.base + +COPY --from=build --chown=root:root /opt/nuclio/open_model_zoo /opt/nuclio/open_model_zoo diff --git a/serverless/openvino/omz/public/faster_rcnn_inception_v2_coco/nuclio/function.yaml b/serverless/openvino/omz/public/faster_rcnn_inception_resnet_v2_atrous_coco/nuclio/function.yaml similarity index 75% rename from serverless/openvino/omz/public/faster_rcnn_inception_v2_coco/nuclio/function.yaml rename to serverless/openvino/omz/public/faster_rcnn_inception_resnet_v2_atrous_coco/nuclio/function.yaml index 800d1bb8189..b85e4dc54b5 100644 --- a/serverless/openvino/omz/public/faster_rcnn_inception_v2_coco/nuclio/function.yaml +++ b/serverless/openvino/omz/public/faster_rcnn_inception_resnet_v2_atrous_coco/nuclio/function.yaml @@ -1,5 +1,5 @@ metadata: - name: openvino-omz-public-faster-rcnn-inception-v2-coco + name: openvino-omz-public-faster-rcnn-inception-resnet-v2-atrous-coco namespace: cvat annotations: name: Faster RCNN @@ -90,40 +90,14 @@ metadata: ] spec: - description: Faster RCNN inception v2 COCO via Intel OpenVINO toolkit - runtime: 'python:3.6' + description: Faster R-CNN with Inception ResNet v2 Atrous via Intel OpenVINO toolkit + runtime: 'python:3.8' handler: main:handler eventTimeout: 30s - env: - - name: NUCLIO_PYTHON_EXE_PATH - value: /opt/nuclio/common/openvino/python3 - - volumes: - - volume: - name: openvino-common - configMap: - name: "cvat-nuclio-openvino-common" - defaultMode: 0750 - volumeMount: - name: openvino-common - mountPath: /opt/nuclio/common/openvino build: - image: cvat.openvino.omz.public.faster_rcnn_inception_v2_coco - 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 faster_rcnn_inception_v2_coco -o /opt/nuclio/open_model_zoo - - kind: RUN - value: /opt/intel/openvino/deployment_tools/open_model_zoo/tools/downloader/converter.py --name faster_rcnn_inception_v2_coco --precisions FP32 -d /opt/nuclio/open_model_zoo -o /opt/nuclio/open_model_zoo + image: cvat.openvino.omz.public.faster_rcnn_inception_resnet_v2_atrous_coco + baseImage: cvat.openvino.omz.public.faster_rcnn_inception_resnet_v2_atrous_coco.base triggers: myHttpTrigger: diff --git a/serverless/openvino/omz/public/faster_rcnn_inception_v2_coco/nuclio/main.py b/serverless/openvino/omz/public/faster_rcnn_inception_resnet_v2_atrous_coco/nuclio/main.py similarity index 92% rename from serverless/openvino/omz/public/faster_rcnn_inception_v2_coco/nuclio/main.py rename to serverless/openvino/omz/public/faster_rcnn_inception_resnet_v2_atrous_coco/nuclio/main.py index 26a9b306f70..6e397c6ddca 100644 --- a/serverless/openvino/omz/public/faster_rcnn_inception_v2_coco/nuclio/main.py +++ b/serverless/openvino/omz/public/faster_rcnn_inception_resnet_v2_atrous_coco/nuclio/main.py @@ -22,7 +22,7 @@ def init_context(context): context.logger.info("Init context...100%") def handler(context, event): - context.logger.info("Run faster_rcnn_inception_v2_coco model") + context.logger.info("Run faster_rcnn_inception_resnet_v2_atrous_coco model") data = event.body buf = io.BytesIO(base64.b64decode(data["image"])) threshold = float(data.get("threshold", 0.5)) diff --git a/serverless/openvino/omz/public/faster_rcnn_inception_v2_coco/nuclio/model_handler.py b/serverless/openvino/omz/public/faster_rcnn_inception_resnet_v2_atrous_coco/nuclio/model_handler.py similarity index 93% rename from serverless/openvino/omz/public/faster_rcnn_inception_v2_coco/nuclio/model_handler.py rename to serverless/openvino/omz/public/faster_rcnn_inception_resnet_v2_atrous_coco/nuclio/model_handler.py index 1f65e63254e..558d17beee7 100644 --- a/serverless/openvino/omz/public/faster_rcnn_inception_v2_coco/nuclio/model_handler.py +++ b/serverless/openvino/omz/public/faster_rcnn_inception_resnet_v2_atrous_coco/nuclio/model_handler.py @@ -8,9 +8,9 @@ class ModelHandler: def __init__(self, labels): base_dir = os.path.abspath(os.environ.get("MODEL_PATH", - "/opt/nuclio/open_model_zoo/public/faster_rcnn_inception_v2_coco/FP32")) - model_xml = os.path.join(base_dir, "faster_rcnn_inception_v2_coco.xml") - model_bin = os.path.join(base_dir, "faster_rcnn_inception_v2_coco.bin") + "/opt/nuclio/open_model_zoo/public/faster_rcnn_inception_resnet_v2_atrous_coco/FP32")) + model_xml = os.path.join(base_dir, "faster_rcnn_inception_resnet_v2_atrous_coco.xml") + model_bin = os.path.join(base_dir, "faster_rcnn_inception_resnet_v2_atrous_coco.bin") self.model = ModelLoader(model_xml, model_bin) self.labels = labels diff --git a/serverless/openvino/omz/public/mask_rcnn_inception_resnet_v2_atrous_coco/nuclio/Dockerfile b/serverless/openvino/omz/public/mask_rcnn_inception_resnet_v2_atrous_coco/nuclio/Dockerfile new file mode 100644 index 00000000000..87af18b8330 --- /dev/null +++ b/serverless/openvino/omz/public/mask_rcnn_inception_resnet_v2_atrous_coco/nuclio/Dockerfile @@ -0,0 +1,23 @@ +FROM openvino/ubuntu20_dev:2022.3.0 AS build + +USER root + +RUN omz_downloader \ + --name mask_rcnn_inception_resnet_v2_atrous_coco \ + -o /opt/nuclio/open_model_zoo.orig + +RUN omz_converter \ + --name mask_rcnn_inception_resnet_v2_atrous_coco \ + --precisions FP32 \ + -d /opt/nuclio/open_model_zoo.orig \ + -o /opt/nuclio/open_model_zoo + +FROM cvat.openvino.base + +USER root + +RUN pip install --no-cache-dir scikit-image + +COPY --from=build /opt/nuclio/open_model_zoo /opt/nuclio/open_model_zoo + +USER openvino diff --git a/serverless/openvino/omz/public/mask_rcnn_inception_resnet_v2_atrous_coco/nuclio/function.yaml b/serverless/openvino/omz/public/mask_rcnn_inception_resnet_v2_atrous_coco/nuclio/function.yaml index 00c7c0ebe0f..b42b678c3e8 100644 --- a/serverless/openvino/omz/public/mask_rcnn_inception_resnet_v2_atrous_coco/nuclio/function.yaml +++ b/serverless/openvino/omz/public/mask_rcnn_inception_resnet_v2_atrous_coco/nuclio/function.yaml @@ -94,45 +94,13 @@ metadata: spec: description: Mask RCNN inception resnet v2 COCO via Intel OpenVINO - runtime: 'python:3.6' + runtime: 'python:3.8' handler: main:handler eventTimeout: 60s - env: - - name: NUCLIO_PYTHON_EXE_PATH - value: /opt/nuclio/common/openvino/python3 - - volumes: - - volume: - name: openvino-common - configMap: - name: "cvat-nuclio-openvino-common" - defaultMode: 0750 - volumeMount: - name: openvino-common - mountPath: /opt/nuclio/common/openvino build: image: cvat.openvino.omz.public.mask_rcnn_inception_resnet_v2_atrous_coco - 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 mask_rcnn_inception_resnet_v2_atrous_coco -o /opt/nuclio/open_model_zoo - - kind: RUN - value: /opt/intel/openvino/deployment_tools/open_model_zoo/tools/downloader/converter.py --name mask_rcnn_inception_resnet_v2_atrous_coco --precisions FP32 -d /opt/nuclio/open_model_zoo -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 + baseImage: cvat.openvino.omz.public.mask_rcnn_inception_resnet_v2_atrous_coco.base triggers: myHttpTrigger: diff --git a/serverless/openvino/omz/public/yolo-v3-tf/nuclio/Dockerfile b/serverless/openvino/omz/public/yolo-v3-tf/nuclio/Dockerfile new file mode 100644 index 00000000000..ce06d713693 --- /dev/null +++ b/serverless/openvino/omz/public/yolo-v3-tf/nuclio/Dockerfile @@ -0,0 +1,17 @@ +FROM openvino/ubuntu20_dev:2022.3.0 AS build + +USER root + +RUN omz_downloader \ + --name yolo-v3-tf \ + -o /opt/nuclio/open_model_zoo.orig + +RUN omz_converter \ + --name yolo-v3-tf \ + --precisions FP32 \ + -d /opt/nuclio/open_model_zoo.orig \ + -o /opt/nuclio/open_model_zoo + +FROM cvat.openvino.base + +COPY --from=build --chown=root:root /opt/nuclio/open_model_zoo /opt/nuclio/open_model_zoo diff --git a/serverless/openvino/omz/public/yolo-v3-tf/nuclio/function.yaml b/serverless/openvino/omz/public/yolo-v3-tf/nuclio/function.yaml index f6d6d464c3e..f1d85b69b04 100644 --- a/serverless/openvino/omz/public/yolo-v3-tf/nuclio/function.yaml +++ b/serverless/openvino/omz/public/yolo-v3-tf/nuclio/function.yaml @@ -91,39 +91,13 @@ metadata: spec: description: YOLO v3 via Intel OpenVINO - runtime: 'python:3.6' + runtime: 'python:3.8' handler: main:handler eventTimeout: 30s - env: - - name: NUCLIO_PYTHON_EXE_PATH - value: /opt/nuclio/common/openvino/python3 - - volumes: - - volume: - name: openvino-common - configMap: - name: "cvat-nuclio-openvino-common" - defaultMode: 0750 - volumeMount: - name: openvino-common - mountPath: /opt/nuclio/common/openvino build: - image: cvat/openvino.omz.public.yolo-v3-tf - 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 yolo-v3-tf -o /opt/nuclio/open_model_zoo - - kind: RUN - value: /opt/intel/openvino/deployment_tools/open_model_zoo/tools/downloader/converter.py --name yolo-v3-tf --precisions FP32 -d /opt/nuclio/open_model_zoo -o /opt/nuclio/open_model_zoo + image: cvat.openvino.omz.public.yolo-v3-tf + baseImage: cvat.openvino.omz.public.yolo-v3-tf.base triggers: myHttpTrigger: diff --git a/serverless/openvino/omz/public/yolo-v3-tf/nuclio/model_handler.py b/serverless/openvino/omz/public/yolo-v3-tf/nuclio/model_handler.py index 3df65d0e2c9..2ddc96d5c8b 100644 --- a/serverless/openvino/omz/public/yolo-v3-tf/nuclio/model_handler.py +++ b/serverless/openvino/omz/public/yolo-v3-tf/nuclio/model_handler.py @@ -4,24 +4,26 @@ import os from math import exp + +import ngraph + from model_loader import ModelLoader class YoloParams: # ------------------------------------------- Extracting layer parameters ------------------------------------------ # Magic numbers are copied from yolo samples def __init__(self, param, side): - self.num = 3 if 'num' not in param else int(param['num']) - self.coords = 4 if 'coords' not in param else int(param['coords']) - self.classes = 80 if 'classes' not in param else int(param['classes']) + self.num = param.get('num', 3) + self.coords = param.get('coords', 4) + self.classes = param.get('classes', 80) self.side = side - self.anchors = [10.0, 13.0, 16.0, 30.0, 33.0, 23.0, 30.0, 61.0, 62.0, 45.0, 59.0, 119.0, 116.0, 90.0, 156.0, - 198.0, - 373.0, 326.0] if 'anchors' not in param else [float(a) for a in param['anchors'].split(',')] + self.anchors = param.get('anchors', [ + 10.0, 13.0, 16.0, 30.0, 33.0, 23.0, 30.0, 61.0, 62.0, 45.0, 59.0, + 119.0, 116.0, 90.0, 156.0, 198.0, 373.0, 326.0]) self.isYoloV3 = False - if param.get('mask'): - mask = [int(idx) for idx in param['mask'].split(',')] + if mask := param.get('mask'): self.num = len(mask) maskedAnchors = [] @@ -119,6 +121,19 @@ def __init__(self, labels): self.model = ModelLoader(model_xml, model_bin) self.labels = labels + ng_func = ngraph.function_from_cnn(self.model.network) + + self.output_info = {} + + for node in ng_func.get_ordered_ops(): + layer_name = node.get_friendly_name() + if layer_name not in self.model.network.outputs: + continue + parent_node = node.inputs()[0].get_source_output().get_node() + shape = list(parent_node.shape) + yolo_params = YoloParams(node._get_attributes(), shape[2]) + self.output_info[layer_name] = (shape, yolo_params) + def infer(self, image, threshold): output_layer = self.model.infer(image) @@ -126,10 +141,10 @@ def infer(self, image, threshold): objects = [] origin_im_size = (image.height, image.width) for layer_name, out_blob in output_layer.items(): - out_blob = out_blob.reshape(self.model.layers[self.model.layers[layer_name].parents[0]].shape) - layer_params = YoloParams(self.model.layers[layer_name].params, out_blob.shape[2]) + shape, yolo_params = self.output_info[layer_name] + out_blob = out_blob.reshape(shape) objects += parse_yolo_region(out_blob, self.model.input_size(), - origin_im_size, layer_params, threshold) + origin_im_size, yolo_params, threshold) # Filtering overlapping boxes (non-maximum suppression) IOU_THRESHOLD = 0.4 From 0228ce6c9b5b8295c3c0455168abafafb93f0bcb Mon Sep 17 00:00:00 2001 From: Roman Donchenko Date: Wed, 10 May 2023 21:18:04 +0400 Subject: [PATCH 04/11] serverless/openvino: make the function names consistent --- .../openvino/omz/intel/face-detection-0205/nuclio/function.yaml | 2 +- .../intel/semantic-segmentation-adas-0001/nuclio/function.yaml | 2 +- .../nuclio/function.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/serverless/openvino/omz/intel/face-detection-0205/nuclio/function.yaml b/serverless/openvino/omz/intel/face-detection-0205/nuclio/function.yaml index 5b9500699fe..09db755ea26 100644 --- a/serverless/openvino/omz/intel/face-detection-0205/nuclio/function.yaml +++ b/serverless/openvino/omz/intel/face-detection-0205/nuclio/function.yaml @@ -1,5 +1,5 @@ metadata: - name: openvino-omz-face-detection-0205 + name: openvino-omz-intel-face-detection-0205 namespace: cvat annotations: name: Attributed face detection diff --git a/serverless/openvino/omz/intel/semantic-segmentation-adas-0001/nuclio/function.yaml b/serverless/openvino/omz/intel/semantic-segmentation-adas-0001/nuclio/function.yaml index d87da0b8880..46b07a69989 100644 --- a/serverless/openvino/omz/intel/semantic-segmentation-adas-0001/nuclio/function.yaml +++ b/serverless/openvino/omz/intel/semantic-segmentation-adas-0001/nuclio/function.yaml @@ -1,5 +1,5 @@ metadata: - name: openvino-omz-semantic-segmentation-adas-0001 + name: openvino-omz-intel-semantic-segmentation-adas-0001 namespace: cvat annotations: name: Semantic segmentation for ADAS diff --git a/serverless/openvino/omz/public/mask_rcnn_inception_resnet_v2_atrous_coco/nuclio/function.yaml b/serverless/openvino/omz/public/mask_rcnn_inception_resnet_v2_atrous_coco/nuclio/function.yaml index b42b678c3e8..f4e2b35f13c 100644 --- a/serverless/openvino/omz/public/mask_rcnn_inception_resnet_v2_atrous_coco/nuclio/function.yaml +++ b/serverless/openvino/omz/public/mask_rcnn_inception_resnet_v2_atrous_coco/nuclio/function.yaml @@ -2,7 +2,7 @@ # have enough memory (more than 4GB). Look here how to do that # https://stackoverflow.com/questions/44417159/docker-process-killed-with-cryptic-killed-message metadata: - name: openvino-mask-rcnn-inception-resnet-v2-atrous-coco + name: openvino-omz-public-mask-rcnn-inception-resnet-v2-atrous-coco namespace: cvat annotations: name: Mask RCNN From 9057d8a9a45db20f0441f7379ed24046ed5efc90 Mon Sep 17 00:00:00 2001 From: Roman Donchenko Date: Thu, 11 May 2023 13:01:48 +0400 Subject: [PATCH 05/11] Update changelog --- CHANGELOG.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 28953c8ec91..030ddd22982 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Running SAM masks decoder on frontend () +- The `person-reidentification-retail-0300` and + `faster_rcnn_inception_v2_coco` Nuclio functions were replaced with + `person-reidentification-retail-0277` and + `faster_rcnn_inception_resnet_v2_atrous_coco`, respectively + (). +- OpenVINO-based Nuclio functions now use the OpenVINO 2022.3 runtime + (). ### Deprecated - TDB @@ -24,6 +31,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - The issue azure.core.exceptions.ResourceExistsError: The specified blob already exists () - Image scaling when moving between images with different resolution () - Invalid completed job count reporting () +- OpenVINO-based Nuclio functions can now be deployed to Kubernetes + (). ### Security - TDB From b61aa7aa1de930ca0b2284cd56e5ce2e77d91536 Mon Sep 17 00:00:00 2001 From: Roman Donchenko Date: Thu, 11 May 2023 13:06:23 +0400 Subject: [PATCH 06/11] Fix Pylint warnings --- .../nuclio/model_handler.py | 2 +- .../openvino/omz/public/yolo-v3-tf/nuclio/model_handler.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/serverless/openvino/omz/public/faster_rcnn_inception_resnet_v2_atrous_coco/nuclio/model_handler.py b/serverless/openvino/omz/public/faster_rcnn_inception_resnet_v2_atrous_coco/nuclio/model_handler.py index 558d17beee7..da13555ce61 100644 --- a/serverless/openvino/omz/public/faster_rcnn_inception_resnet_v2_atrous_coco/nuclio/model_handler.py +++ b/serverless/openvino/omz/public/faster_rcnn_inception_resnet_v2_atrous_coco/nuclio/model_handler.py @@ -36,4 +36,4 @@ def infer(self, image, threshold): "type": "rectangle", }) - return results \ No newline at end of file + return results diff --git a/serverless/openvino/omz/public/yolo-v3-tf/nuclio/model_handler.py b/serverless/openvino/omz/public/yolo-v3-tf/nuclio/model_handler.py index 2ddc96d5c8b..ef277796653 100644 --- a/serverless/openvino/omz/public/yolo-v3-tf/nuclio/model_handler.py +++ b/serverless/openvino/omz/public/yolo-v3-tf/nuclio/model_handler.py @@ -172,4 +172,4 @@ def infer(self, image, threshold): "type": "rectangle", }) - return results \ No newline at end of file + return results From 8230d9b40f4a30877d3e521e91f32ef3e4755c9a Mon Sep 17 00:00:00 2001 From: Roman Donchenko Date: Fri, 12 May 2023 12:46:58 +0400 Subject: [PATCH 07/11] serverless/deploy_cpu.sh: minor updates * fail early * use Docker Buildkit --- serverless/deploy_cpu.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/serverless/deploy_cpu.sh b/serverless/deploy_cpu.sh index ebb0a24726d..8fc1dacc453 100755 --- a/serverless/deploy_cpu.sh +++ b/serverless/deploy_cpu.sh @@ -1,9 +1,13 @@ #!/bin/bash # Sample commands to deploy nuclio functions on CPU +set -eu + SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" FUNCTIONS_DIR=${1:-$SCRIPT_DIR} +export DOCKER_BUILDKIT=1 + docker build -t cvat.openvino.base "$SCRIPT_DIR/openvino/base" nuctl create project cvat --platform local From fc3cca7243539a285a26647b61247b3069ce8bc2 Mon Sep 17 00:00:00 2001 From: Roman Donchenko Date: Fri, 12 May 2023 13:17:48 +0400 Subject: [PATCH 08/11] serverless/deploy_gpu.sh: synchronize with recent changes from deploy_cpu.sh I didn't migrate the changes related to `docker build` commands, since none of the GPU-based functions have separate Dockerfiles yet. --- serverless/deploy_gpu.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/serverless/deploy_gpu.sh b/serverless/deploy_gpu.sh index ed323ae75f8..c813a8232ad 100755 --- a/serverless/deploy_gpu.sh +++ b/serverless/deploy_gpu.sh @@ -1,20 +1,23 @@ #!/bin/bash # Sample commands to deploy nuclio functions on GPU +set -eu + SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" FUNCTIONS_DIR=${1:-$SCRIPT_DIR} -nuctl create project cvat +nuctl create project cvat --platform local shopt -s globstar for func_config in "$FUNCTIONS_DIR"/**/function-gpu.yaml do - func_root=$(dirname "$func_config") - echo "Deploying $(dirname "$func_root") function..." + func_root="$(dirname "$func_config")" + func_rel_path="$(realpath --relative-to="$SCRIPT_DIR" "$(dirname "$func_root")")" + + echo "Deploying $func_rel_path function..." nuctl deploy --project-name cvat --path "$func_root" \ - --volume "$SCRIPT_DIR/common:/opt/nuclio/common" \ --file "$func_config" --platform local done -nuctl get function +nuctl get function --platform local From ccad38c3ab9e478b9e12021ad359c3641616894d Mon Sep 17 00:00:00 2001 From: Roman Donchenko Date: Fri, 12 May 2023 16:42:51 +0400 Subject: [PATCH 09/11] Update docs after recent serverless function changes Remove the sample output for the nuclio deployment step(s), because a) it's a long wall of text that doesn't really demonstrate anything, and b) it gets even longer after recent changes, because the `docker build` commands log all build steps. --- .../installation_automatic_annotation.md | 27 ++----- .../setup-additional-components.md | 79 +++---------------- 2 files changed, 17 insertions(+), 89 deletions(-) diff --git a/site/content/en/docs/administration/advanced/installation_automatic_annotation.md b/site/content/en/docs/administration/advanced/installation_automatic_annotation.md index b6c4f2558e1..635c07a757f 100644 --- a/site/content/en/docs/administration/advanced/installation_automatic_annotation.md +++ b/site/content/en/docs/administration/advanced/installation_automatic_annotation.md @@ -45,33 +45,16 @@ description: 'Information about the installation of components needed for semi-a sudo ln -sf $(pwd)/nuctl--linux-amd64 /usr/local/bin/nuctl ``` -- Create `cvat` project inside nuclio dashboard where you will deploy new serverless functions - and deploy a couple of DL models. Commands below should be run only after CVAT has been installed +- Deploy a couple of functions. + This will automatically create a `cvat` Nuclio project to contain the functions. + Commands below should be run only after CVAT has been installed using `docker compose` because it runs nuclio dashboard which manages all serverless functions. ```bash - nuctl create project cvat + ./serverless/deploy_cpu.sh serverless/openvino/dextr + ./serverless/deploy_cpu.sh serverless/openvino/omz/public/yolo-v3-tf ``` - ```bash - nuctl deploy --project-name cvat \ - --path serverless/openvino/dextr/nuclio \ - --volume `pwd`/serverless/common:/opt/nuclio/common \ - --platform local - ``` - - ```bash - nuctl deploy --project-name cvat \ - --path serverless/openvino/omz/public/yolo-v3-tf/nuclio \ - --volume `pwd`/serverless/common:/opt/nuclio/common \ - --platform local - ``` - - **Note:** - - - See [deploy_cpu.sh](https://github.com/cvat-ai/cvat/blob/develop/serverless/deploy_cpu.sh) - for more examples. - #### GPU Support You will need to install [Nvidia Container Toolkit](https://www.tensorflow.org/install/docker#gpu_support). diff --git a/site/content/en/docs/contributing/setup-additional-components.md b/site/content/en/docs/contributing/setup-additional-components.md index e3ee1b7eecb..5aa3f3861b4 100644 --- a/site/content/en/docs/contributing/setup-additional-components.md +++ b/site/content/en/docs/contributing/setup-additional-components.md @@ -15,69 +15,14 @@ Follow this [guide](/docs/administration/advanced/installation_automatic_annotat of the Nuclio dashboard. All you need in order to run the dashboard is Docker. See [nuclio documentation](https://github.com/nuclio/nuclio#quick-start-steps) for more details. -- Create `cvat` project inside nuclio dashboard where you will deploy new - serverless functions and deploy a couple of DL models. +- Deploy a couple of functions. + This will automatically create a `cvat` Nuclio project to contain the functions. ```bash -nuctl create project cvat +./serverless/deploy_cpu.sh serverless/openvino/dextr +./serverless/deploy_cpu.sh serverless/openvino/omz/public/yolo-v3-tf ``` -```bash -nuctl deploy --project-name cvat \ - --path serverless/openvino/dextr/nuclio \ - --volume `pwd`/serverless/common:/opt/nuclio/common \ - --platform local -``` - -
- -``` -20.07.17 12:02:23.247 nuctl (I) Deploying function {"name": ""} -20.07.17 12:02:23.248 nuctl (I) Building {"versionInfo": "Label: 1.4.8, Git commit: 238d4539ac7783896d6c414535d0462b5f4cbcf1, OS: darwin, Arch: amd64, Go version: go1.14.3", "name": ""} -20.07.17 12:02:23.447 nuctl (I) Cleaning up before deployment -20.07.17 12:02:23.535 nuctl (I) Function already exists, deleting -20.07.17 12:02:25.877 nuctl (I) Staging files and preparing base images -20.07.17 12:02:25.891 nuctl (I) Building processor image {"imageName": "cvat/openvino.dextr:latest"} -20.07.17 12:02:25.891 nuctl.platform.docker (I) Pulling image {"imageName": "quay.io/nuclio/handler-builder-python-onbuild:1.4.8-amd64"} -20.07.17 12:02:29.270 nuctl.platform.docker (I) Pulling image {"imageName": "quay.io/nuclio/uhttpc:0.0.1-amd64"} -20.07.17 12:02:33.208 nuctl.platform (I) Building docker image {"image": "cvat/openvino.dextr:latest"} -20.07.17 12:02:34.464 nuctl.platform (I) Pushing docker image into registry {"image": "cvat/openvino.dextr:latest", "registry": ""} -20.07.17 12:02:34.464 nuctl.platform (I) Docker image was successfully built and pushed into docker registry {"image": "cvat/openvino.dextr:latest"} -20.07.17 12:02:34.464 nuctl (I) Build complete {"result": {"Image":"cvat/openvino.dextr:latest","UpdatedFunctionConfig":{"metadata":{"name":"openvino.dextr","namespace":"nuclio","labels":{"nuclio.io/project-name":"cvat"},"annotations":{"framework":"openvino","spec":"","type":"interactor"}},"spec":{"description":"Deep Extreme Cut","handler":"main:handler","runtime":"python:3.6","env":[{"name":"NUCLIO_PYTHON_EXE_PATH","value":"/opt/nuclio/python3"}],"resources":{},"image":"cvat/openvino.dextr:latest","targetCPU":75,"triggers":{"myHttpTrigger":{"class":"","kind":"http","name":"","maxWorkers":2,"workerAvailabilityTimeoutMilliseconds":10000,"attributes":{"maxRequestBodySize":33554432}}},"volumes":[{"volume":{"name":"volume-1","hostPath":{"path":"/Users/nmanovic/Workspace/cvat/serverless/openvino/common"}},"volumeMount":{"name":"volume-1","mountPath":"/opt/nuclio/common"}}],"build":{"image":"cvat/openvino.dextr","baseImage":"openvino/ubuntu18_runtime:2020.2","directives":{"postCopy":[{"kind":"RUN","value":"curl -O https://download.01.org/openvinotoolkit/models_contrib/cvat/dextr_model_v1.zip"},{"kind":"RUN","value":"unzip dextr_model_v1.zip"},{"kind":"RUN","value":"pip3 install Pillow"},{"kind":"USER","value":"openvino"}],"preCopy":[{"kind":"USER","value":"root"},{"kind":"WORKDIR","value":"/opt/nuclio"},{"kind":"RUN","value":"ln -s /usr/bin/pip3 /usr/bin/pip"}]},"codeEntryType":"image"},"platform":{},"readinessTimeoutSeconds":60,"eventTimeout":"30s"}}}} -20.07.17 12:02:35.012 nuctl.platform (I) Waiting for function to be ready {"timeout": 60} -20.07.17 12:02:37.448 nuctl (I) Function deploy complete {"httpPort": 55274} -``` - -
- -```bash -nuctl deploy --project-name cvat \ - --path serverless/openvino/omz/public/yolo-v3-tf/nuclio \ - --volume `pwd`/serverless/common:/opt/nuclio/common \ - --platform local -``` - -
- -``` -20.07.17 12:05:23.377 nuctl (I) Deploying function {"name": ""} -20.07.17 12:05:23.378 nuctl (I) Building {"versionInfo": "Label: 1.4.8, Git commit: 238d4539ac7783896d6c414535d0462b5f4cbcf1, OS: darwin, Arch: amd64, Go version: go1.14.3", "name": ""} -20.07.17 12:05:23.590 nuctl (I) Cleaning up before deployment -20.07.17 12:05:23.694 nuctl (I) Function already exists, deleting -20.07.17 12:05:24.271 nuctl (I) Staging files and preparing base images -20.07.17 12:05:24.274 nuctl (I) Building processor image {"imageName": "cvat/openvino.omz.public.yolo-v3-tf:latest"} -20.07.17 12:05:24.274 nuctl.platform.docker (I) Pulling image {"imageName": "quay.io/nuclio/handler-builder-python-onbuild:1.4.8-amd64"} -20.07.17 12:05:27.432 nuctl.platform.docker (I) Pulling image {"imageName": "quay.io/nuclio/uhttpc:0.0.1-amd64"} -20.07.17 12:05:31.462 nuctl.platform (I) Building docker image {"image": "cvat/openvino.omz.public.yolo-v3-tf:latest"} -20.07.17 12:05:32.798 nuctl.platform (I) Pushing docker image into registry {"image": "cvat/openvino.omz.public.yolo-v3-tf:latest", "registry": ""} -20.07.17 12:05:32.798 nuctl.platform (I) Docker image was successfully built and pushed into docker registry {"image": "cvat/openvino.omz.public.yolo-v3-tf:latest"} -20.07.17 12:05:32.798 nuctl (I) Build complete {"result": {"Image":"cvat/openvino.omz.public.yolo-v3-tf:latest","UpdatedFunctionConfig":{"metadata":{"name":"openvino.omz.public.yolo-v3-tf","namespace":"nuclio","labels":{"nuclio.io/project-name":"cvat"},"annotations":{"framework":"openvino","name":"YOLO v3","spec":"[\n { \"id\": 0, \"name\": \"person\" },\n { \"id\": 1, \"name\": \"bicycle\" },\n { \"id\": 2, \"name\": \"car\" },\n { \"id\": 3, \"name\": \"motorbike\" },\n { \"id\": 4, \"name\": \"aeroplane\" },\n { \"id\": 5, \"name\": \"bus\" },\n { \"id\": 6, \"name\": \"train\" },\n { \"id\": 7, \"name\": \"truck\" },\n { \"id\": 8, \"name\": \"boat\" },\n { \"id\": 9, \"name\": \"traffic light\" },\n { \"id\": 10, \"name\": \"fire hydrant\" },\n { \"id\": 11, \"name\": \"stop sign\" },\n { \"id\": 12, \"name\": \"parking meter\" },\n { \"id\": 13, \"name\": \"bench\" },\n { \"id\": 14, \"name\": \"bird\" },\n { \"id\": 15, \"name\": \"cat\" },\n { \"id\": 16, \"name\": \"dog\" },\n { \"id\": 17, \"name\": \"horse\" },\n { \"id\": 18, \"name\": \"sheep\" },\n { \"id\": 19, \"name\": \"cow\" },\n { \"id\": 20, \"name\": \"elephant\" },\n { \"id\": 21, \"name\": \"bear\" },\n { \"id\": 22, \"name\": \"zebra\" },\n { \"id\": 23, \"name\": \"giraffe\" },\n { \"id\": 24, \"name\": \"backpack\" },\n { \"id\": 25, \"name\": \"umbrella\" },\n { \"id\": 26, \"name\": \"handbag\" },\n { \"id\": 27, \"name\": \"tie\" },\n { \"id\": 28, \"name\": \"suitcase\" },\n { \"id\": 29, \"name\": \"frisbee\" },\n { \"id\": 30, \"name\": \"skis\" },\n { \"id\": 31, \"name\": \"snowboard\" },\n { \"id\": 32, \"name\": \"sports ball\" },\n { \"id\": 33, \"name\": \"kite\" },\n { \"id\": 34, \"name\": \"baseball bat\" },\n { \"id\": 35, \"name\": \"baseball glove\" },\n { \"id\": 36, \"name\": \"skateboard\" },\n { \"id\": 37, \"name\": \"surfboard\" },\n { \"id\": 38, \"name\": \"tennis racket\" },\n { \"id\": 39, \"name\": \"bottle\" },\n { \"id\": 40, \"name\": \"wine glass\" },\n { \"id\": 41, \"name\": \"cup\" },\n { \"id\": 42, \"name\": \"fork\" },\n { \"id\": 43, \"name\": \"knife\" },\n { \"id\": 44, \"name\": \"spoon\" },\n { \"id\": 45, \"name\": \"bowl\" },\n { \"id\": 46, \"name\": \"banana\" },\n { \"id\": 47, \"name\": \"apple\" },\n { \"id\": 48, \"name\": \"sandwich\" },\n { \"id\": 49, \"name\": \"orange\" },\n { \"id\": 50, \"name\": \"broccoli\" },\n { \"id\": 51, \"name\": \"carrot\" },\n { \"id\": 52, \"name\": \"hot dog\" },\n { \"id\": 53, \"name\": \"pizza\" },\n { \"id\": 54, \"name\": \"donut\" },\n { \"id\": 55, \"name\": \"cake\" },\n { \"id\": 56, \"name\": \"chair\" },\n { \"id\": 57, \"name\": \"sofa\" },\n { \"id\": 58, \"name\": \"pottedplant\" },\n { \"id\": 59, \"name\": \"bed\" },\n { \"id\": 60, \"name\": \"diningtable\" },\n { \"id\": 61, \"name\": \"toilet\" },\n { \"id\": 62, \"name\": \"tvmonitor\" },\n { \"id\": 63, \"name\": \"laptop\" },\n { \"id\": 64, \"name\": \"mouse\" },\n { \"id\": 65, \"name\": \"remote\" },\n { \"id\": 66, \"name\": \"keyboard\" },\n { \"id\": 67, \"name\": \"cell phone\" },\n { \"id\": 68, \"name\": \"microwave\" },\n { \"id\": 69, \"name\": \"oven\" },\n { \"id\": 70, \"name\": \"toaster\" },\n { \"id\": 71, \"name\": \"sink\" },\n { \"id\": 72, \"name\": \"refrigerator\" },\n { \"id\": 73, \"name\": \"book\" },\n { \"id\": 74, \"name\": \"clock\" },\n { \"id\": 75, \"name\": \"vase\" },\n { \"id\": 76, \"name\": \"scissors\" },\n { \"id\": 77, \"name\": \"teddy bear\" },\n { \"id\": 78, \"name\": \"hair drier\" },\n { \"id\": 79, \"name\": \"toothbrush\" }\n]\n","type":"detector"}},"spec":{"description":"YOLO v3 via Intel OpenVINO","handler":"main:handler","runtime":"python:3.6","env":[{"name":"NUCLIO_PYTHON_EXE_PATH","value":"/opt/nuclio/common/python3"}],"resources":{},"image":"cvat/openvino.omz.public.yolo-v3-tf:latest","targetCPU":75,"triggers":{"myHttpTrigger":{"class":"","kind":"http","name":"","maxWorkers":2,"workerAvailabilityTimeoutMilliseconds":10000,"attributes":{"maxRequestBodySize":33554432}}},"volumes":[{"volume":{"name":"volume-1","hostPath":{"path":"/Users/nmanovic/Workspace/cvat/serverless/openvino/common"}},"volumeMount":{"name":"volume-1","mountPath":"/opt/nuclio/common"}}],"build":{"image":"cvat/openvino.omz.public.yolo-v3-tf","baseImage":"openvino/ubuntu18_dev:2020.2","directives":{"postCopy":[{"kind":"USER","value":"openvino"}],"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 yolo-v3-tf -o /opt/nuclio/open_model_zoo"},{"kind":"RUN","value":"/opt/intel/openvino/deployment_tools/open_model_zoo/tools/downloader/converter.py --name yolo-v3-tf --precisions FP32 -d /opt/nuclio/open_model_zoo -o /opt/nuclio/open_model_zoo"}]},"codeEntryType":"image"},"platform":{},"readinessTimeoutSeconds":60,"eventTimeout":"30s"}}}} -20.07.17 12:05:33.285 nuctl.platform (I) Waiting for function to be ready {"timeout": 60} -20.07.17 12:05:35.452 nuctl (I) Function deploy complete {"httpPort": 57308} -``` - -
- - Display a list of running serverless functions using `nuctl` command or see them in nuclio dashboard: @@ -103,23 +48,23 @@ image=$(curl https://upload.wikimedia.org/wikipedia/en/7/7d/Lenna_%28test_image% cat << EOF > /tmp/input.json {"image": "$image"} EOF -cat /tmp/input.json | nuctl invoke openvino.omz.public.yolo-v3-tf -c 'application/json' +cat /tmp/input.json | nuctl invoke openvino-omz-public-yolo-v3-tf -c 'application/json' ```
``` -20.07.17 12:07:44.519 nuctl.platform.invoker (I) Executing function {"method": "POST", "url": "http://:57308", "headers": {"Content-Type":["application/json"],"X-Nuclio-Log-Level":["info"],"X-Nuclio-Target":["openvino.omz.public.yolo-v3-tf"]}} -20.07.17 12:07:45.275 nuctl.platform.invoker (I) Got response {"status": "200 OK"} -20.07.17 12:07:45.275 nuctl (I) >>> Start of function logs -20.07.17 12:07:45.275 ino.omz.public.yolo-v3-tf (I) Run yolo-v3-tf model {"worker_id": "0", "time": 1594976864570.9353} -20.07.17 12:07:45.275 nuctl (I) <<< End of function logs +23.05.11 22:14:17.275 nuctl.platform.invoker (I) Executing function {"method": "POST", "url": "http://0.0.0.0:32771", "bodyLength": 631790, "headers": {"Content-Type":["application/json"],"X-Nuclio-Log-Level":["info"],"X-Nuclio-Target":["openvino-omz-public-yolo-v3-tf"]}} +23.05.11 22:14:17.788 nuctl.platform.invoker (I) Got response {"status": "200 OK"} +23.05.11 22:14:17.789 nuctl (I) >>> Start of function logs +23.05.11 22:14:17.789 ino-omz-public-yolo-v3-tf (I) Run yolo-v3-tf model {"worker_id": "0", "time": 1683828857301.8765} +23.05.11 22:14:17.789 nuctl (I) <<< End of function logs > Response headers: -Date = Fri, 17 Jul 2020 09:07:45 GMT +Server = nuclio +Date = Thu, 11 May 2023 18:14:17 GMT Content-Type = application/json Content-Length = 100 -Server = nuclio > Response body: [ From 6adb68fabf6ef4f53debb83b0567d5fd173ffc59 Mon Sep 17 00:00:00 2001 From: Roman Donchenko Date: Fri, 12 May 2023 16:45:51 +0400 Subject: [PATCH 10/11] Remove the /opt/nuclio/common config map from the Helm chart It's no longer needed, since after recent changes, the common files are baked into each image (that requires them). This also decouples our Helm chart from the rest of the repository, which I think is nice. --- helm-chart/nuclio_func_common_files | 1 - helm-chart/templates/cvat_nuclio/config.yml | 19 ------------------- 2 files changed, 20 deletions(-) delete mode 120000 helm-chart/nuclio_func_common_files delete mode 100644 helm-chart/templates/cvat_nuclio/config.yml diff --git a/helm-chart/nuclio_func_common_files b/helm-chart/nuclio_func_common_files deleted file mode 120000 index 8e401ec14f5..00000000000 --- a/helm-chart/nuclio_func_common_files +++ /dev/null @@ -1 +0,0 @@ -../serverless/common/openvino \ No newline at end of file diff --git a/helm-chart/templates/cvat_nuclio/config.yml b/helm-chart/templates/cvat_nuclio/config.yml deleted file mode 100644 index d0357507174..00000000000 --- a/helm-chart/templates/cvat_nuclio/config.yml +++ /dev/null @@ -1,19 +0,0 @@ -{{- if .Values.nuclio.enabled }} -apiVersion: v1 -kind: ConfigMap -metadata: - name: cvat-nuclio-openvino-common - namespace: {{ .Release.Namespace }} - labels: - {{- include "cvat.labels" . | nindent 4 }} - app: cvat-app - tier: nuclio -{{- if semverCompare ">=1.21-0" .Capabilities.KubeVersion.GitVersion }} -immutable: true -{{- end }} -binaryData: - python3: |- - {{ .Files.Get "nuclio_func_common_files/python3" | b64enc }} - model_loader.py: - {{ .Files.Get "nuclio_func_common_files/model_loader.py" | b64enc }} -{{- end}} From 244e9973a998e506256c2b6a3e2610ee473a12fe Mon Sep 17 00:00:00 2001 From: Roman Donchenko Date: Fri, 12 May 2023 16:53:30 +0400 Subject: [PATCH 11/11] serverless/openvino: prevent unnecessary downloads By default, Model Downloader downloads all available precisions. --- .../openvino/omz/intel/face-detection-0205/nuclio/Dockerfile | 1 + .../intel/person-reidentification-retail-0277/nuclio/Dockerfile | 1 + .../omz/intel/semantic-segmentation-adas-0001/nuclio/Dockerfile | 1 + .../openvino/omz/intel/text-detection-0004/nuclio/Dockerfile | 1 + 4 files changed, 4 insertions(+) diff --git a/serverless/openvino/omz/intel/face-detection-0205/nuclio/Dockerfile b/serverless/openvino/omz/intel/face-detection-0205/nuclio/Dockerfile index b70dff4ffa2..b721e21ddfd 100644 --- a/serverless/openvino/omz/intel/face-detection-0205/nuclio/Dockerfile +++ b/serverless/openvino/omz/intel/face-detection-0205/nuclio/Dockerfile @@ -4,6 +4,7 @@ USER root RUN omz_downloader \ --name face-detection-0205,emotions-recognition-retail-0003,age-gender-recognition-retail-0013 \ + --precisions FP32 \ -o /opt/nuclio/open_model_zoo FROM cvat.openvino.base diff --git a/serverless/openvino/omz/intel/person-reidentification-retail-0277/nuclio/Dockerfile b/serverless/openvino/omz/intel/person-reidentification-retail-0277/nuclio/Dockerfile index 1791444f171..b878c46af9e 100644 --- a/serverless/openvino/omz/intel/person-reidentification-retail-0277/nuclio/Dockerfile +++ b/serverless/openvino/omz/intel/person-reidentification-retail-0277/nuclio/Dockerfile @@ -4,6 +4,7 @@ USER root RUN omz_downloader \ --name person-reidentification-retail-0277 \ + --precisions FP32 \ -o /opt/nuclio/open_model_zoo FROM cvat.openvino.base diff --git a/serverless/openvino/omz/intel/semantic-segmentation-adas-0001/nuclio/Dockerfile b/serverless/openvino/omz/intel/semantic-segmentation-adas-0001/nuclio/Dockerfile index 6e9ec83c2d3..6ca2bb6c045 100644 --- a/serverless/openvino/omz/intel/semantic-segmentation-adas-0001/nuclio/Dockerfile +++ b/serverless/openvino/omz/intel/semantic-segmentation-adas-0001/nuclio/Dockerfile @@ -4,6 +4,7 @@ USER root RUN omz_downloader \ --name semantic-segmentation-adas-0001 \ + --precisions FP32 \ -o /opt/nuclio/open_model_zoo FROM cvat.openvino.base diff --git a/serverless/openvino/omz/intel/text-detection-0004/nuclio/Dockerfile b/serverless/openvino/omz/intel/text-detection-0004/nuclio/Dockerfile index 74818551e6f..d00748400d3 100644 --- a/serverless/openvino/omz/intel/text-detection-0004/nuclio/Dockerfile +++ b/serverless/openvino/omz/intel/text-detection-0004/nuclio/Dockerfile @@ -4,6 +4,7 @@ USER root RUN omz_downloader \ --name text-detection-0004 \ + --precisions FP32 \ -o /opt/nuclio/open_model_zoo FROM cvat.openvino.base