From 94cf19dac42c9dee09f4bbfcd9c7e6a72e666c68 Mon Sep 17 00:00:00 2001 From: Jacob Pedersen Date: Mon, 16 Jul 2018 21:22:34 +0200 Subject: [PATCH 1/2] Fixed a minor spelling mistake in docker readme --- docker/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/README.md b/docker/README.md index 1bf6458..942aee9 100644 --- a/docker/README.md +++ b/docker/README.md @@ -42,7 +42,7 @@ Example: nvidia-docker run --rm -it -p 8888:8888 -p 6006:6006 -v /home/jacob/andet/training/docker-training-shared:/root/sharedfolder:Z tensorflow-improved:latest-gpu ``` -**Be aware!** GPU training is a lot faster than CPU, but it requires an Nvidia GPU and Nvidia Cuda to be installed and working on the host machine. +**Be aware!** GPU training is a lot faster than CPU, but it requires a Nvidia GPU and *Nvidia Cuda* to be installed and working on the host machine. It also requires the host to have *NVIDIA Container Runtime for Docker* installed. You can read more about it here: https://github.com/NVIDIA/nvidia-docker You can test if it's working by running the following test container with the command below. If it doesn't throw an error, you're golden. From 600449f10c254b5fd191536e27342d9fc93d9c98 Mon Sep 17 00:00:00 2001 From: Jacob Pedersen Date: Thu, 13 Sep 2018 00:11:46 +0200 Subject: [PATCH 2/2] Added readme badges for containers --- README.md | 12 ++++++++++++ docker/Dockerfile | 15 ++++++++++++--- docker/Dockerfile.gpu | 14 ++++++++++++-- docker/README.md | 13 ++++++++++++- docker/hooks/build | 8 ++++++++ 5 files changed, 56 insertions(+), 6 deletions(-) create mode 100644 docker/hooks/build diff --git a/README.md b/README.md index 3f31abd..9075ee9 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,7 @@ # Object Detection with TensorFlow and Java +[![Docker Pulls](https://img.shields.io/docker/pulls/jacobpeddk/tensorflow-improved.svg)](https://hub.docker.com/r/jacobpeddk/tensorflow-improved) +[![Docker Stars](https://img.shields.io/docker/stars/jacobpeddk/tensorflow-improved.svg)](https://hub.docker.com/r/jacobpeddk/tensorflow-improved) + I've gone trough a lot of trouble for figuring out how to both prepare a dataset, train a model with TensorFlow, and how to use it from a Java program. So from all my effort, this repository contains somewhat detailed guides on how you can train your own model. @@ -18,3 +21,12 @@ You can find the fairly detailed guide on how to prepare a dataset and train a m ## [Docker containers](docker) Information about the customized containers, can be found in [the folder named docker.](docker) +### CPU Container +[![](https://images.microbadger.com/badges/image/jacobpeddk/tensorflow-improved.svg)](https://microbadger.com/images/jacobpeddk/tensorflow-improved "Container Image size and layers") +[![](https://images.microbadger.com/badges/commit/jacobpeddk/tensorflow-improved.svg)](https://microbadger.com/images/jacobpeddk/tensorflow-improved "Current commit that the container is build from") +[![](https://images.microbadger.com/badges/version/jacobpeddk/tensorflow-improved.svg)](https://microbadger.com/images/jacobpeddk/tensorflow-improved "Container version") + +### GPU Container +[![](https://images.microbadger.com/badges/image/jacobpeddk/tensorflow-improved:latest-gpu.svg)](https://microbadger.com/images/jacobpeddk/tensorflow-improved "Container Image size and layers") +[![](https://images.microbadger.com/badges/commit/jacobpeddk/tensorflow-improved:latest-gpu.svg)](https://microbadger.com/images/jacobpeddk/tensorflow-improved "Current commit that the container is build from") +[![](https://images.microbadger.com/badges/version/jacobpeddk/tensorflow-improved:latest-gpu.svg)](https://microbadger.com/images/jacobpeddk/tensorflow-improved "Container version") diff --git a/docker/Dockerfile b/docker/Dockerfile index f0b035d..141114d 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -6,7 +6,15 @@ #FROM tensorflow/tensorflow:latest-devel #FROM tensorflow/tensorflow:1.9.0-rc1-devel FROM tensorflow/tensorflow:1.8.0-devel -MAINTAINER Jacob Pedersen + +ARG BUILD_DATE +ARG VCS_REF + +MAINTAINER jacobpeddk +LABEL maintainer="jacobpeddk" +LABEL org.label-schema.build-date=$BUILD_DATE +LABEL org.label-schema.vcs-url="https://github.com/jacobped/java-tensorflow-object-detection" +LABEL org.label-schema.vcs-ref=$VCS_REF ENV DEBIAN_FRONTEND noninteractive ENV RUNLEVEL 1 @@ -32,7 +40,9 @@ RUN apt-get update -y && apt-get install -y \ python-tk \ cython \ vim \ - less + less && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* # Install extra python dependencies with pip RUN pip --no-cache-dir install \ @@ -73,4 +83,3 @@ WORKDIR /root/sharedfolder EXPOSE 8888/tcp # TensorBoard EXPOSE 6006/tcp - diff --git a/docker/Dockerfile.gpu b/docker/Dockerfile.gpu index 9959fd6..cdce2f3 100644 --- a/docker/Dockerfile.gpu +++ b/docker/Dockerfile.gpu @@ -6,7 +6,15 @@ #FROM tensorflow/tensorflow:latest-devel-gpu #FROM tensorflow/tensorflow:1.9.0-rc1-devel-gpu FROM tensorflow/tensorflow:1.8.0-devel-gpu -MAINTAINER Jacob Pedersen + +ARG BUILD_DATE +ARG VCS_REF + +MAINTAINER jacobpeddk +LABEL maintainer="jacobpeddk" +LABEL org.label-schema.build-date=$BUILD_DATE +LABEL org.label-schema.vcs-url="https://github.com/jacobped/java-tensorflow-object-detection" +LABEL org.label-schema.vcs-ref=$VCS_REF ENV DEBIAN_FRONTEND noninteractive ENV RUNLEVEL 1 @@ -32,7 +40,9 @@ RUN apt-get update -y && apt-get install -y \ python-tk \ cython \ vim \ - less + less && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* # Install extra python dependencies with pip RUN pip --no-cache-dir install \ diff --git a/docker/README.md b/docker/README.md index 942aee9..dd77bfa 100644 --- a/docker/README.md +++ b/docker/README.md @@ -1,4 +1,7 @@ # Docker containers for TensorFlow Object-Detection +[![Docker Pulls](https://img.shields.io/docker/pulls/jacobpeddk/tensorflow-improved.svg)](https://hub.docker.com/r/jacobpeddk/tensorflow-improved) +[![Docker Stars](https://img.shields.io/docker/stars/jacobpeddk/tensorflow-improved.svg)](https://hub.docker.com/r/jacobpeddk/tensorflow-improved) + TensorFlow Docker containers with Improvements and fixes for training Objekt Detection models. Can also be used to train models for classification of entire images. @@ -15,18 +18,26 @@ I'd recommend mapping a directory into the containers, so you can have the train This and related documents will expect the host folder with the data to be mapped to: `/root/sharedfolder` ### CPU container +[![](https://images.microbadger.com/badges/image/jacobpeddk/tensorflow-improved.svg)](https://microbadger.com/images/jacobpeddk/tensorflow-improved "Container Image size and layers") +[![](https://images.microbadger.com/badges/commit/jacobpeddk/tensorflow-improved.svg)](https://microbadger.com/images/jacobpeddk/tensorflow-improved "Current commit that the container is build from") +[![](https://images.microbadger.com/badges/version/jacobpeddk/tensorflow-improved.svg)](https://microbadger.com/images/jacobpeddk/tensorflow-improved "Container version") + For launching the container that uses the CPU for training, use the following command: ``` docker run --rm -it -p 8888:8888 -p 6006:6006 -v :/root/sharedfolder:Z tensorflow-improved:latest ``` -**Remember to replace \ with the actual path on your host machine!** +**Remember to replace \ with the actual path on your host machine!** Example: ``` docker run --rm -it -p 8888:8888 -p 6006:6006 -v /home/jacob/andet/training/docker-training-shared:/root/sharedfolder:Z tensorflow-improved:latest ``` ### GPU container +[![](https://images.microbadger.com/badges/image/jacobpeddk/tensorflow-improved:latest-gpu.svg)](https://microbadger.com/images/jacobpeddk/tensorflow-improved "Container Image size and layers") +[![](https://images.microbadger.com/badges/commit/jacobpeddk/tensorflow-improved:latest-gpu.svg)](https://microbadger.com/images/jacobpeddk/tensorflow-improved "Current commit that the container is build from") +[![](https://images.microbadger.com/badges/version/jacobpeddk/tensorflow-improved:latest-gpu.svg)](https://microbadger.com/images/jacobpeddk/tensorflow-improved "Container version") + For launching the container that uses the GPU for training, use the following command: ``` nvidia-docker run --rm -it -p 8888:8888 -p 6006:6006 -v :/root/sharedfolder:Z tensorflow-improved:latest-gpu diff --git a/docker/hooks/build b/docker/hooks/build new file mode 100644 index 0000000..1011fa0 --- /dev/null +++ b/docker/hooks/build @@ -0,0 +1,8 @@ +#!/bin/bash + +# $IMAGE_NAME var is injected into the build so the tag is correct. + +echo "Build hook running" +docker build --build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \ + --build-arg VCS_REF=`git rev-parse --short HEAD` \ + -t $IMAGE_NAME .