Skip to content

Commit

Permalink
Add python to CI (#53)
Browse files Browse the repository at this point in the history
* Add python to CI
  • Loading branch information
rasapala authored Nov 13, 2023
1 parent 9c1a20d commit 925a323
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 12 deletions.
20 changes: 13 additions & 7 deletions Dockerfile.openvino
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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


15 changes: 13 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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

3 changes: 2 additions & 1 deletion WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion ci/testOnCommit.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
}
}
}
}

2 changes: 1 addition & 1 deletion mediapipe/modules/ovms_modules/object_detection_ovms.pbtxt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}
Expand Down

0 comments on commit 925a323

Please sign in to comment.