Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjustments for OpenVINO v5 #997

Merged
merged 6 commits into from
Mar 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions contrib/components/openvino/model_convert/containers/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
unzip \
vim && \
apt-get clean
RUN curl -L -o 2018_R3.tar.gz https://github.com/opencv/dldt/archive/2018_R3.tar.gz && \
tar -zxf 2018_R3.tar.gz && \
rm 2018_R3.tar.gz && \
rm -Rf dldt-2018_R3/inference-engine
WORKDIR dldt-2018_R3/model-optimizer
RUN curl -L -o 2018_R5.tar.gz https://github.com/opencv/dldt/archive/2018_R5.tar.gz && \
tar -zxf 2018_R5.tar.gz && \
rm 2018_R5.tar.gz && \
rm -Rf dldt-2018_R5/inference-engine
WORKDIR dldt-2018_R5/model-optimizer
RUN pip3 install --upgrade pip setuptools
RUN pip3 install -r requirements.txt
RUN curl -L -o google-cloud-sdk.zip https://dl.google.com/dl/cloudsdk/release/google-cloud-sdk.zip && \
Expand All @@ -28,7 +28,7 @@ RUN curl -L -o google-cloud-sdk.zip https://dl.google.com/dl/cloudsdk/release/go
tools/google-cloud-sdk/bin/gcloud config set component_manager/disable_update_check true && \
touch tools/google-cloud-sdk/lib/third_party/google.py && \
pip install -U crcmod
ENV PATH ${PATH}:/dldt-2018_R3/model-optimizer:/dldt-2018_R3/model-optimizer/tools/google-cloud-sdk/bin
ENV PATH ${PATH}:/dldt-2018_R5/model-optimizer:/dldt-2018_R5/model-optimizer/tools/google-cloud-sdk/bin
COPY convert_model.py .
RUN chmod 755 *.py
WORKDIR input
Expand Down
25 changes: 19 additions & 6 deletions contrib/components/openvino/predict/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,23 @@
This component takes the following parameters:
* path to the model in Intermediate Representation format ( xml and bin files)
* numpy file with the input dataset. Input shape should fit to the used model definition.
* classification labels which can be used to calculate model accuracy
* input data can be scaled using parameters scale_div and scale_sub
* path to the folder where the inference results in numpy format should be uploaded

In the component logs are included inference performance details.

It is a generic component which can be used to process arbitrary data and any OpenVINO model.
It can be also considered as an example how to create more customized version.
This component is tuned for classification models but can be considered as exemplary for arbitrary OpenVINO models.

There are generated 2 metrics including inference latency and accuracy

```bash
python3 predict.py --help
usage: predict.py [-h] [--model_bin MODEL_BIN] [--model_xml MODEL_XML]
[--input_numpy_file INPUT_NUMPY_FILE]
[--output_folder OUTPUT_FOLDER]
predict.py --help
usage: predict.py [-h] --model_bin MODEL_BIN --model_xml MODEL_XML
--input_numpy_file INPUT_NUMPY_FILE --label_numpy_file
LABEL_NUMPY_FILE --output_folder OUTPUT_FOLDER
[--batch_size BATCH_SIZE] [--scale_div SCALE_DIV]
[--scale_sub SCALE_SUB]

Component executing inference operation

Expand All @@ -26,8 +31,16 @@ optional arguments:
GCS or local path to model graph (.xml)
--input_numpy_file INPUT_NUMPY_FILE
GCS or local path to input dataset numpy file
--label_numpy_file LABEL_NUMPY_FILE
GCS or local path to numpy file with labels
--output_folder OUTPUT_FOLDER
GCS or local path to results upload folder
--batch_size BATCH_SIZE
batch size to be used for inference
--scale_div SCALE_DIV
scale the np input by division of by the value
--scale_sub SCALE_SUB
scale the np input by substraction of the value
```


Expand Down
35 changes: 19 additions & 16 deletions contrib/components/openvino/predict/containers/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,37 +34,40 @@ RUN apt-get update && apt-get install -y \
gstreamer1.0-plugins-base \
libusb-1.0-0-dev \
libopenblas-dev
RUN curl -L -o 2018_R3.tar.gz https://github.com/opencv/dldt/archive/2018_R3.tar.gz && \
tar -zxf 2018_R3.tar.gz && \
rm 2018_R3.tar.gz && \
rm -Rf dldt-2018_R3/model-optimizer
WORKDIR dldt-2018_R3/inference-engine
RUN mkdir build && cd build && cmake -DGEMM=MKL -DENABLE_MKL_DNN=ON -DCMAKE_BUILD_TYPE=Release ..
ARG DLDT_DIR=/dldt-2018_R5
RUN git clone --depth=1 -b 2018_R5 https://github.com/opencv/dldt.git ${DLDT_DIR} && \
cd ${DLDT_DIR} && git submodule init && git submodule update --recursive && \
rm -Rf .git && rm -Rf model-optimizer

WORKDIR ${DLDT_DIR}
RUN curl -L -o ${DLDT_DIR}/mklml_lnx_2019.0.1.20180928.tgz https://github.com/intel/mkl-dnn/releases/download/v0.17.2/mklml_lnx_2019.0.1.20180928.tgz && \
tar -xzf ${DLDT_DIR}/mklml_lnx_2019.0.1.20180928.tgz && rm ${DLDT_DIR}/mklml_lnx_2019.0.1.20180928.tgz
WORKDIR ${DLDT_DIR}/inference-engine
RUN mkdir build && cd build && cmake -DGEMM=MKL -DMKLROOT=${DLDT_DIR}/mklml_lnx_2019.0.1.20180928 -DENABLE_MKL_DNN=ON -DCMAKE_BUILD_TYPE=Release ..
RUN cd build && make -j4
RUN pip3 install cython numpy && mkdir ie_bridges/python/build && cd ie_bridges/python/build && \
cmake -DInferenceEngine_DIR=/dldt-2018_R3/inference-engine/build -DPYTHON_EXECUTABLE=`which python3` -DPYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.5m.so -DPYTHON_INCLUDE_DIR=/usr/include/python3.5m .. && \
cmake -DInferenceEngine_DIR=${DLDT_DIR}/inference-engine/build -DPYTHON_EXECUTABLE=`which python3` -DPYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.5m.so -DPYTHON_INCLUDE_DIR=/usr/include/python3.5m .. && \
make -j4


FROM ubuntu:16.04 as PROD
WORKDIR /predict

RUN apt-get update && apt-get install -y \
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
ca-certificates \
python3-pip \
python3-dev \
vim \
virtualenv
virtualenv \
libgomp1

COPY --from=DEV /dldt-2018_R3/inference-engine/bin/intel64/Release/lib/*.so /usr/local/lib/
COPY --from=DEV /dldt-2018_R3/inference-engine/ie_bridges/python/build/ /usr/local/lib/
COPY --from=DEV /dldt-2018_R3/inference-engine/temp/mkltiny_lnx_20180511/lib/libiomp5.so /usr/local/lib/
COPY --from=DEV /dldt-2018_R5/inference-engine/bin/intel64/Release/lib/*.so /usr/local/lib/
COPY --from=DEV /dldt-2018_R5/inference-engine/ie_bridges/python/bin/intel64/Release/python_api/python3.5/openvino/ /usr/local/lib/openvino/
COPY --from=DEV /dldt-2018_R5/mklml_lnx_2019.0.1.20180928/lib/lib*.so /usr/local/lib/
ENV LD_LIBRARY_PATH=/usr/local/lib
ENV PYTHONPATH=/usr/local/lib
COPY requirements.txt .
RUN pip3 install setuptools wheel
RUN pip3 install -r requirements.txt
COPY predict.py .
COPY predict.py classes.py ./



Expand Down
Loading