From 925a323465685fcc050a4ced93ca247dc70420a0 Mon Sep 17 00:00:00 2001 From: Rafal Sapala Date: Mon, 13 Nov 2023 09:33:11 +0100 Subject: [PATCH] Add python to CI (#53) * Add python to CI --- Dockerfile.openvino | 20 ++++++++++++------- Makefile | 15 ++++++++++++-- WORKSPACE | 3 ++- ci/testOnCommit.groovy | 7 ++++++- .../ovms_modules/object_detection_ovms.pbtxt | 2 +- 5 files changed, 35 insertions(+), 12 deletions(-) diff --git a/Dockerfile.openvino b/Dockerfile.openvino index f52f2557cb..9cd1f6e10c 100644 --- a/Dockerfile.openvino +++ b/Dockerfile.openvino @@ -124,16 +124,18 @@ tar xvf boost_1_69_0.tar.gz && cd boost_1_69_0 && ./bootstrap.sh && \ --with-log --with-locale \ install -ARG OVMS_BRANCH="mediapipe_integration" +# Main at Fix building without MediaPipe (#2129) +# Update SHA in two places here and in WORKSPACE ovms git repository +ARG OVMS_COMMIT="7f372bc9b0a94cf546ef5f1a43e4a9bf768d6f85" RUN mkdir /opt/ovms -RUN wget -nv -P /opt/ovms https://raw.githubusercontent.com/openvinotoolkit/model_server/${OVMS_BRANCH}/third_party/cpprest/rest_sdk_v2.10.16.patch -RUN wget -nv -P /opt/ovms https://raw.githubusercontent.com/openvinotoolkit/model_server/${OVMS_BRANCH}/third_party/azure/azure_sdk.patch -RUN wget -nv -P /opt/ovms https://raw.githubusercontent.com/openvinotoolkit/model_server/${OVMS_BRANCH}/third_party/build_bazel_rules_apple/bazel_rules_apple.patch +RUN wget -nv -P /opt/ovms https://raw.githubusercontent.com/openvinotoolkit/model_server/${OVMS_COMMIT}/third_party/cpprest/rest_sdk_v2.10.16.patch +RUN wget -nv -P /opt/ovms https://raw.githubusercontent.com/openvinotoolkit/model_server/${OVMS_COMMIT}/third_party/azure/azure_sdk.patch +RUN wget -nv -P /opt/ovms https://raw.githubusercontent.com/openvinotoolkit/model_server/${OVMS_COMMIT}/third_party/build_bazel_rules_apple/bazel_rules_apple.patch RUN mkdir -p /root/ovms/dummy/1 -RUN wget -nv -O /root/ovms/config.json https://raw.githubusercontent.com/openvinotoolkit/model_server/${OVMS_BRANCH}/src/test/mediapipe/config_standard_dummy.json +RUN wget -nv -O /root/ovms/config.json https://raw.githubusercontent.com/openvinotoolkit/model_server/${OVMS_COMMIT}/src/test/mediapipe/config_standard_dummy.json RUN sed -i 's:/ovms/src/test/dummy:/root/ovms/dummy:g' /root/ovms/config.json -RUN wget -nv -O /root/ovms/dummy/1/dummy.xml https://raw.githubusercontent.com/openvinotoolkit/model_server/${OVMS_BRANCH}/src/test/dummy/1/dummy.xml -RUN wget -nv -O /root/ovms/dummy/1/dummy.bin https://raw.githubusercontent.com/openvinotoolkit/model_server/${OVMS_BRANCH}/src/test/dummy/1/dummy.bin +RUN wget -nv -O /root/ovms/dummy/1/dummy.xml https://raw.githubusercontent.com/openvinotoolkit/model_server/${OVMS_COMMIT}/src/test/dummy/1/dummy.xml +RUN wget -nv -O /root/ovms/dummy/1/dummy.bin https://raw.githubusercontent.com/openvinotoolkit/model_server/${OVMS_COMMIT}/src/test/dummy/1/dummy.bin ####### Azure SDK WORKDIR /azure @@ -187,4 +189,8 @@ RUN python setup_ovms.py --get_models && python setup_ovms.py --convert_pose --f RUN bash build_desktop_examples.sh -b RUN curl https://storage.googleapis.com/mediapipe-assets/ssdlite_object_detection_labelmap.txt -o mediapipe/models/ssdlite_object_detection_labelmap.txt +# BUILD python framework +RUN pip install -r requirements.txt +RUN python setup.py install + diff --git a/Makefile b/Makefile index 6addd10496..d18a214cac 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,8 @@ HTTP_PROXY := "$(http_proxy)" HTTPS_PROXY := "$(https_proxy)" OVMS_MEDIA_DOCKER_IMAGE ?= mediapipe_ovms OVMS_MEDIA_IMAGE_TAG ?= latest -OVMS_BRANCH ?= "mediapipe_integration" +# Main at Fix building without MediaPipe (#2129) +OVMS_COMMIT ?="7f372bc9b0a94cf546ef5f1a43e4a9bf768d6f85" JOBS ?= $(shell python3 -c 'import multiprocessing as mp; print(mp.cpu_count())') DLDT_PACKAGE_URL ?= https://storage.openvinotoolkit.org/repositories/openvino/packages/2023.0/linux/l_openvino_toolkit_ubuntu20_2023.0.0.10926.b4452d56304_x86_64.tgz @@ -28,7 +29,7 @@ docker_build: --build-arg http_proxy=$(HTTP_PROXY) --build-arg https_proxy=$(HTTPS_PROXY) \ --build-arg DLDT_PACKAGE_URL=$(DLDT_PACKAGE_URL) \ --build-arg JOBS=$(JOBS) . \ - --build-arg OVMS_BRANCH=$(OVMS_BRANCH) \ + --build-arg OVMS_COMMIT=$(OVMS_COMMIT) \ -t $(OVMS_MEDIA_DOCKER_IMAGE):$(OVMS_MEDIA_IMAGE_TAG) tests: run_unit_tests run_hello_world run_hello_ovms @@ -49,9 +50,14 @@ run_demos_in_docker: # report error if performance reported for less then 5 demos cat test_demos.log | grep -a FPS: | wc -l | grep -q "5" +run_python_demos_in_docker: + docker run $(OVMS_MEDIA_DOCKER_IMAGE):$(OVMS_MEDIA_IMAGE_TAG) make run_python_demos + # Targets to use inside running mediapipe_ovms container run_demos: run_holistic_tracking run_face_detection run_iris_tracking run_object_detection run_pose_tracking +run_python_demos: run_python_object_detection + run_object_detection: echo "Running FPS test for object_detection demo" rm -rf /mediapipe/output_object_detection_ovms.mp4 @@ -81,3 +87,8 @@ run_pose_tracking: if [ ! -f video.mp4 ]; then wget -O video.mp4 "https://www.pexels.com/download/video/3044127/?fps=24.0&h=1080&w=1920"; fi bazel-bin/mediapipe/examples/desktop/pose_tracking/pose_tracking_cpu --calculator_graph_config_file /mediapipe/mediapipe/graphs/pose_tracking/pose_tracking_cpu.pbtxt --input_video_path=/mediapipe/video.mp4 --output_video_path=/mediapipe/output_pose_track_ovms.mp4 +run_python_object_detection: + echo "Running python ovms object detection demo" + cp build/lib.linux-x86_64-cpython-38/mediapipe/examples/python/ovms_object_detection.py build/lib.linux-x86_64-cpython-38 + python build/lib.linux-x86_64-cpython-38/ovms_object_detection.py + diff --git a/WORKSPACE b/WORKSPACE index 64dce0ccbe..228b9ac362 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -640,10 +640,11 @@ http_archive( load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") +# Update SHA in two places Dockerfile.openvino - ARG OVMS_COMMIT and here git_repository( name = "ovms", remote = "https://github.com/openvinotoolkit/model_server", - commit = "ad1381fde838f2ac2d23117df78c186a96134fcc", # Fix azure patch (#2107) + commit = "7f372bc9b0a94cf546ef5f1a43e4a9bf768d6f85", # Fix building without MediaPipe (#2129) ) # DEV ovms - adjust local repository path for build diff --git a/ci/testOnCommit.groovy b/ci/testOnCommit.groovy index c98f47ce85..09f41c3c1f 100644 --- a/ci/testOnCommit.groovy +++ b/ci/testOnCommit.groovy @@ -22,11 +22,16 @@ pipeline { sh script: "make tests OVMS_MEDIA_IMAGE_TAG=${shortCommit}" } } - stage("test demos") { + stage("test cpp demos") { steps { sh script: "make run_demos_in_docker OVMS_MEDIA_IMAGE_TAG=${shortCommit}" } } + stage("test python demos") { + steps { + sh script: "make run_python_demos_in_docker OVMS_MEDIA_IMAGE_TAG=${shortCommit}" + } + } } } diff --git a/mediapipe/modules/ovms_modules/object_detection_ovms.pbtxt b/mediapipe/modules/ovms_modules/object_detection_ovms.pbtxt index a58a1f8ba9..fd3acb6598 100644 --- a/mediapipe/modules/ovms_modules/object_detection_ovms.pbtxt +++ b/mediapipe/modules/ovms_modules/object_detection_ovms.pbtxt @@ -58,7 +58,7 @@ node { [type.googleapis.com / mediapipe.OpenVINOModelServerSessionCalculatorOptions]: { servable_name: "ssdlite_object_detection" # servable name inside OVMS servable_version: "1" - server_config: "mediapipe/calculators/ovms/config.json" + server_config: "/mediapipe/mediapipe/calculators/ovms/config.json" } } }