diff --git a/Dockerfile b/Dockerfile index 99513e7..18ff1ab 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,21 @@ FROM tensorflow/tensorflow:1.15.0-py3 -# this is based on https://github.com/IntelAI/OpenVINO-model-server/blob/master/Dockerfile WORKDIR /app # basic install RUN apt-get update && apt-get install -y --no-install-recommends \ ca-certificates \ + libsm6 \ + libxext6 \ + libxrender-dev \ + libgtk-3-0 \ lsb-core \ sudo +# additional python dependencies +copy requirements.txt /app +RUN pip --no-cache-dir install -r requirements.txt + # download OpenVINO RUN curl -o GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB RUN apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB @@ -16,8 +23,7 @@ RUN echo "deb https://apt.repos.intel.com/openvino/2019/ all main" > /etc/apt/so # install OpenVINO RUN apt-get update && apt-get install -y intel-openvino-dev-ubuntu18-2019.3.376 RUN cd /opt/intel/openvino/deployment_tools/model_optimizer/install_prerequisites/ && ./install_prerequisites_tf.sh -RUN /opt/intel/openvino/bin/setupvars.sh -# additional python dependencies -copy requirements.txt /app -RUN pip --no-cache-dir install -r requirements.txt \ No newline at end of file +# enviornment setup +RUN echo source /opt/intel/openvino/bin/setupvars.sh >> /root/.bashrc +CMD ["/bin/bash", "-l"] \ No newline at end of file diff --git a/Makefile b/Makefile index e5d1063..c5a965d 100644 --- a/Makefile +++ b/Makefile @@ -44,11 +44,12 @@ help: @echo ' run run docker $(IMG) as $(APP) for current user: $(HOST_USER)(uid=$(HOST_UID))' @echo ' shell open interactive shell to stopped container $(APP) for current user' @echo ' stop stop $(APP)' + @echo ' start start $(APP)' @echo ' test test the model with tensorflow on data in data/test' @echo ' train train a model on data in the data/train directory' @echo '' -all: | build run train convert_32 +all: | build run train convert_32 infer build: sudo docker build -t $(IMG) . @@ -63,7 +64,8 @@ convert_32: sudo docker exec -w /app/models/openvino $(APP) python $(MO_TF) --input_model /app/models/$(MOD).pb -b $(BATCH_SIZE) --data_type FP32 --scale 255 --reverse_input_channels; infer: - sudo docker exec $(APP) python infer/classification_sample.py -m /app/models/openvino/$(MOD).xml -nt 5 -i /app/data/infer/ -d CPU + sudo docker exec $(APP) /bin/bash -c \ + ". /opt/intel/openvino/bin/setupvars.sh && python infer/classification_sample.py -m /app/models/openvino/$(MOD).xml -nt 5 -i /app/data/infer/* -d CPU" prune: sudo docker system prune -af @@ -74,9 +76,15 @@ rebuild: run: sudo docker run -u $(HOST_UID):$(HOST_GID) -it -d --mount type=bind,source=${CURDIR},destination=/app,consistency=cached --name $(APP) $(IMG); +run_root: + sudo docker run -it -d --mount type=bind,source=${CURDIR},destination=/app,consistency=cached --name $(APP) $(IMG); + shell: sudo docker start -i $(APP) +start: + sudo docker start $(APP) + stop: sudo docker stop $(APP) diff --git a/requirements.txt b/requirements.txt index ccfdcc4..6b771ee 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ networkx==2.3 Pillow -SciPy \ No newline at end of file +SciPy +opencv-python-headless \ No newline at end of file