Condividi tramite


[Post Invitado] Part 1. Analysis and Object Detection of Artworks with Tensorflow(GPU) on Windows 10

En esta serie de artículos, Alexander Gonzalez, Microsoft Student Partner, te explica cómo utilizar Tensorflow en Azure para el análisis y detección de objetos utilizando como ejemplo obras de arte. Forma parte de su Trabajo Final de Grado para el Grado en Ingeniería Informática.


Nowadays, all major technology companies are committed to innovative projects using technologies such as Machine Learning, Deep Learning. Both will be the most important technologies for 2018, making a difference on the currently way of living and working. Machine learning and Deep learning are constantly making new business models, jobs, as well as, innovative and efficient industries.

Machine learning is around us more than we think. It can be found in mobile phones, cars, homes and in our own job, helping us to make better decisions, access to higher quality information and faster. According to several surveys and analytical companies, these technologies will be present in all the new software products in 2020.

From the business point of view, artificial intelligence (AI) will be used a stepping stone to improve and increase the effectiveness and efficiency of the services of any company as well as quality for the user. The trends indicate that most sectors will see radical changes in the way they use all their products, the only risk of such change is to completely ignore it. In the future, products that we currently know will change thanks to the AI . Furthermore, and it is calculated that in the next three years, around 1.2 trillion dollars will change hands thanks to this new field in computing. Consequently, this means that every year the AI is taking a lot of strength and support; therefore, it will leave a mark setting differences between companies in the up-coming years.

The objective of these post series is to show the possibilities that we currently have to perform machine learning and computer vision projects which they will be published in 4 parts:

1. The first part is dedicated to the installation and explanation of the software that we will need to take any project in this case, with TensorFlow, CUDA and CuDNN.

2. The second part will cover step by step the necessary processes to make our dataset, in this case artworks images, followed by training. Finally, the evaluation and obtaining of relevant graphics for the preparation of documentation will be explained. [Link to be added]

[embed]https://www.youtube.com/watch?v=wue_odBwAP8[/embed]

Image of Fast-RCNN on surface webcam with python program

[embed]https://www.youtube.com/watch?v=mO-FyZmkYhE[/embed]

Image of Fast-RCNN on MS Surface webcam with python program

[embed]https://www.youtube.com/watch?v=4mTmQ_hE9Tg[/embed]

Image of SSD-Mobilenet on LG mobile

3. The third post will explain another way of recognizing and classifying images (20 artworks) using scikit learn and python without having to use models of TensorFlow, CNTK or other technologies which offer models of convolved neural networks. Moreover, we will explain how to set up your own web app with python. For this part a fairly simple API which will collect information about the captured image of our mobile application in Xamarin will be needed, so it will inference with our model made in python, and it will return the corresponding prediction. With that methodology we can get easy classification without heavy hardware like TensorFlow or CNTK. [Link to be added]

4. Finally, the last post is dedicated to a comparison between the use of TensorFlow and CNTK, the results obtained, the management and usability, points of interest and final conclusions about the research that has been carried out for the development of all the posts. [Link to be added]

 

1. How to install Tensorflow 1.5 on Windows 10 with CUDA and CudaDNN

Prerequisites

• Nvidia GPU (GTX 650 or newer. The GTX1050 is a good entry level choice)
• Anaconda with Python 3.6(or 3.5)
• CUDA ToolKit(versión 9)
• CuDNN(7.1.1)

If we want to get results quickly the first thing to think about is with what hardware we will face our computer vision project, since the demands are high in terms of GPU and processing. My advice is to use Data Science Virtual Machine that Azure supports. They are complete virtual machines preconfigured for the modelling, development and implementation of science data. Below, I highlight several documents provided by Azure team that will help us understand the provisioning of these machines and prices:

https://azure.microsoft.com/es-es/services/virtual-machines/data-science-virtual-machines/
/es-es/azure/machine-learning/data-science-virtual-machine/provision-vm
/es-es/azure/machine-learning/data-science-virtual-machine/overview
*Note: We must install a Data Science virtual machine of NC6 or NV6 model with GPU.
Once we have our machine created, we can start to install

Download CUDA 9.0

First of all, we will have to install CUDA Tool Kit:
• Download version 9.0 here: https://developer.nvidia.com/cuda-downloads
• Currently version 9.0 is supported by Tensorflow 1.5

Installer type exe(network) is the lighter way one. More complete one is exe(local)

Set your environment Variables:

• Go to start and search “environment variables”
• Click th environmen variables button
• Add the following paths:
o C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\extras\CUPTI\libx64
o C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\libnvvp
o C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\bin

In data Science machine we have CUDA install and we can find this path already install
Variable name: CUDA_PATH_V9_0
Variable value: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0

Download CUDNN 8.0

• Go to https://developer.nvidia.com/rdp/cudnn-download
• Create a user profile if needed
• Select CUDNN 7.1.1 for CUDA tool kit 9.0

• Extract the zip file and place them somewhere (C:// directory for example)
• Add a in environment variable path to the bin folder: For example: C:/cuda/bin

Update GPU Driver

• Go to https://www.nvidia.com/Download/index.aspx
• Select your version to download
• Install the drive

Install Anaconda 3.6

In these VM Anaconda environment has been installed. Howver, the installation steps of Anaconda were not explained in this post.

Install Tensorflow GPU on Windows 10

Open your cmd window and type the following command:

pip install –ignore-installed –upgrade tensorflow-gpu

Notes: Tensorflow documentation: https://www.tensorflow.org/install/

Test your tensorflow install:

1. Open anaconda prompt

2. Write “python –-version

3. Write “python

4. Once the interpreter opens type the following:

 import tensorflow as tf
hello= tf.constant('Hello, Tensorflow!')  
Sess = tf.session()  
print(sess.run(hello)) 

In the next post, we will cover step by step the necessary processes to make our dataset. In this case, artwork images, followed by training and finally the evaluation and obtaining relevant graphics for document preparation. Index of the next post:
1. Labelling pictures 2. Generating training data 3. Creating a label map and configuring training
4. Training
5. Exporting the inference graph
6. Testing and using your newly trained object detection classifier

 

Kind regards,
Alexander González (@GlezGlez96)
Microsoft Student Partner