From 877fb852fe6632b455826bb949456b01c3d1613b Mon Sep 17 00:00:00 2001 From: Emil Goude Date: Fri, 17 Aug 2018 09:46:47 +0200 Subject: [PATCH 1/2] First version of a dockerfile To support running this tutorial inside a Docker container which will hopefully make setup easier --- docker/DockerFile | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 docker/DockerFile diff --git a/docker/DockerFile b/docker/DockerFile new file mode 100644 index 00000000..41f9cf22 --- /dev/null +++ b/docker/DockerFile @@ -0,0 +1,34 @@ +FROM "ubuntu" +RUN apt-get update && yes | apt-get upgrade +RUN apt-get update +RUN apt-get install -y git python-pip libsm6 libxrender-dev python-pil python-lxml protobuf-compiler +RUN mkdir -p /tensorflow/models + +COPY ts-models/models /tensorflow/models +COPY edje-tutorial/TensorFlow-Object-Detection-API-Tutorial-Train-Multiple-Objects-Windows-10 /tensorflow/models/research/object_detection +COPY faster_rcnn_inception_v2_coco_2018_01_28.tar.gz /tensorflow/models/research/object_detection +COPY inference_graph /tensorflow/models/research/object_detection/inference_graph + +WORKDIR /tensorflow/models/research/object_detection +RUN tar -xzf faster_rcnn_inception_v2_coco_2018_01_28.tar.gz + +WORKDIR /tensorflow/models/research + +RUN pip install tensorflow +RUN pip install jupyter +RUN pip install matplotlib +RUN pip install Cython +RUN pip install pandas +RUN pip install opencv-python + +RUN protoc object_detection/protos/*.proto --python_out=. +RUN export PYTHONPATH=$PYTHONPATH:`pwd`:`pwd`/slim + +RUN python setup.py build +RUN python setup.py install + +RUN jupyter notebook --generate-config --allow-root +RUN echo "c.NotebookApp.password = u'sha1:6a3f528eec40:6e896b6e4828f525a6e20e5411cd1c8075d68619'" >> /root/.jupyter/jupyter_notebook_config.py +EXPOSE 8888 + +CMD ["jupyter", "notebook", "--allow-root", "--notebook-dir=/tensorflow/models/research/object_detection", "--ip='*'", "--port=8888", "--no-browser"] From ad34b9a6e78f7e4eaf14190c9b00f7a004c78457 Mon Sep 17 00:00:00 2001 From: Emil Goude Date: Fri, 17 Aug 2018 09:47:46 +0200 Subject: [PATCH 2/2] Adding a readme file To make it easier to build and run the container. --- docker/readme.txt | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 docker/readme.txt diff --git a/docker/readme.txt b/docker/readme.txt new file mode 100644 index 00000000..e3cb142b --- /dev/null +++ b/docker/readme.txt @@ -0,0 +1,37 @@ +# This work build upon the Docker container created in this example: +# https://towardsdatascience.com/tensorflow-object-detection-with-docker-from-scratch-5e015b639b0b + +1. Manual download dependencies needed for the container +# Download TensorFlow models and examples +git clone https://github.com/tensorflow/models.git + +# Download EdjeElectronics tutorial +git clone https://github.com/EdjeElectronics/TensorFlow-Object-Detection-API-#Tutorial-Train-Multiple-Objects-Windows-10.git + +# Download (and unzip) inference_graph into folder inference_graph +https://www.dropbox.com/s/va9ob6wcucusse1/inference_graph.zip?dl=0 + +Your directory should now look like this: + ++ edje-tutorial ++ inference_graph ++ ts_models (contains models/research/... folders) +DockerFile +faster_rcnn_inception_v2_coco_2018_01_28.tar.gz +readme.txt + +2. Build and run the docker container +Download and install Docker if yoiu havent already, make sure your Docker is set to "Linux Containers" +Now open up a command line and navigate to this directory + +docker build -t ts-api . +< = Should finish without any major errors + +Now start the container: +docker run -it --name ts-api -p 8888:8888 ts-api /bin/bash +If you donw want interactive container, simply run +docker run --name ts-api -p 8888:8888 ts-api + +If everything is ok, you should be able to browse http://localhost:8888 and see the Jupyter login prompt + +