Machine learning environment setup within 10min!!! – Noteworthy – The Journal Blog

Machine learning environment setup within 10min!!! – Noteworthy – The Journal Blog

https://ift.tt/2MJHLQK


One of the main problems of machine learning part is installing software because we need to research algorithm, framework and software library for identifying suitable technology for our application. Installing new software’s & libraries takes some time.We may also face some issues during the setup process. To overcome these problems we ought for some technique, which is a docker environment.

Why Docker for machine learning???

Docker will take care of below issues.

Issues 1: Most of the Machine learning application is running with third -party library and software. Here, A developer, while deploying an application to the production server has to maintain a note of the software’s that are installed in the local development machine.

Issues 2: Machine learning world provides a wide range of third party applications which can be consumed by our application. For example, Detection of an object from webcam can be done through Open CV and Open GL software) Here, a developer faces hindrance about the feasibility and speed of the software to our application. Installing more & more software’s to the application would make the machine to be slow or to crash.

Issues 3: Version conflict of languages is another important problem faced by the developers. Example, Running two different projects which is built on python 2 and python 3 respectively on the same machine is not possible.

Issues 4: We need to download and install software manually in our system, but in Docker environment, its just a single command and build the application. Version switching is easier here.

Use case of machine learning with docker

Here, We are going to see Tensorflow object detection with docker.

Tensorflow with docker

Now the time to choose an option for machine learning environment.

Option 1: If you want to run tensorflow object detection app in your machine, You need to install below dependencies here.

  • Protobuf 3.0.0
  • Python-tk
  • Pillow 1.0
  • lxml
  • tf Slim (which is included in the “tensorflow/models/research/” checkout)
  • Jupyter notebook
  • Matplotlib
  • Tensorflow (>=1.9.0)
  • Cython
  • contextlib2
  • cocoapi

Option 2: Install docker on your machine here.

First, Create docker file in your application path and paste the below command on it.

FROM tensorflow/tensorflow:latest

Run the Docker build command.

Now, the tensorflow environment is ready!!!

If you want to install open CV, Just add this one line on docker file.

RUN apt-get install python-opencv -y

I prefer docker compose is a good one to go. So below is my docker and docker compose file for object detection with docker.

Docker file

FROM tensorflow/tensorflow:latest
RUN apt-get update
RUN apt-get install python-opencv -y
ENV APP_HOME /app
WORKDIR $APP_HOME
ADD . $APP_HOME

Docker-compose.yml

version: “3.3”
services:
app:
build: .
command: “python /app/'YOUR PYTHON FILE'.py”
ports:
— 8888:8888
volumes:
— .:/app
— /tmp/.X11-unix:/tmp/.X11-unix
— /tmp/.docker.xauth:/tmp/.docker.xauth
privileged: true
environment:
— DISPLAY=$DISPLAY
devices:
— /dev/video0:/dev/video0

NOTE : Here the issue is docker has no GUI so we are using X server here and access our system webcam use this command.

/dev/video0:/dev/video0

Object detection

Today most of the Machine Learning Projects are research works. Hence Docker would be the best tool to explore all libraries, software’s without wasting our time for installation or system crashing.

$……………….……………… Happy coding………………………………….$


More where this came from

This story is published in Noteworthy, where thousands come every day to learn about the people & ideas shaping the products we love.

Follow our publication to see more product & design stories featured by the Journal team.

Publish

via Noteworthy – The Journal Blog

September 3, 2018 at 07:17AM https://ift.tt/2MJHLQK

Be the first to comment

Leave a Reply

Your email address will not be published.


*