Authorized transfer from THU Data Group (datapi)
Translation: Fang Fang, He Xuan
Proofreading: Ding Nanya
“————
Deep learning is fundamentally changing everything around us. Many people believe that only experts can apply deep learning in applications, but this is not the case.
In this article, we will learn how to use deep learning to build various applications such as automatic image tagging, clothing recommendation, music production, and many others. Any of these applications can be completed in just a few minutes.
————”
PS. This article assumes you have a basic understanding of Python. If you are not familiar with it, please refer to this tutorial (https://www.analyticsvidhya.com/blog/2016/01/complete-tutorial-learn-data-science-python-scratch-2/) before starting here.
Content List
▼
1. Applications using existing APIs
-
Automatic image tagging using Clarifai API
-
Clothing recommendation system using Indico API
2. Open-source applications
-
Music production using deep learning
-
Detecting Not Safe For Work (NSFW) images
3. Implementing super-resolution
-
Other commonly used resources
1. Applications of Deep Learning Using Existing APIs
▼
1.1 Automatic Image Tagging
(Clarifai API)
Image tagging is one of the groundbreaking applications of deep learning. Unlike text data, it is much more difficult for machines to parse image data, as they need to understand pixel data at a deeper level. Therefore, we analyze images through tagging, which allows us to classify images and identify corresponding objects.
This is why we use image tagging to analyze images. Image tagging can tell us what the image classification and identified objects are.
Here is an example of predicting image tags through deep learning:
Now let’s see how the API provided by Clarifai tags features for each of the images above.
System Requirements and Instructions:
1. Python (2 or 3)
2. Internet connection (to access the API endpoint)
Step 1: Register on the Clarifai website to obtain an API key. Then find the API certificate on the developer page (https://indico.io/demos/clothing-matching).
Step 2: Enter the following command in the terminal to install the Clarifai Python client
Step 3: Use the Clarifai client to configure the system
This step requires providing the client ID and client secret, which can be found on the developer page.
Step 4: Create a file named application.py and add the following code to tag the image. Remember to replace
Then run the code with the following command
You will get the following output:
This JSON output shows the predicted results. You can find the relevant tags in outputs->data->concept->name.
1.2 Clothing Recommendation
(Indico API)
Recommendation systems are becoming a huge asset. With the increase in product variety, businesses need a tool that can intelligently target potential consumers. Deep learning can greatly assist us in this area.
I am not a fashionable person, but I find that people waste a lot of time choosing what to wear. Wouldn’t it be great if there were an AI agent that knew our preferences and could suggest the best combinations?
Fortunately, deep learning is making this possible.
You can find a demo of this application here (https://indico.io/demos/clothing-matching).
The official article (https://indico.io/blog/fashion-matching-tutorial/) contains more detailed descriptions. Now let’s see how to build this recommendation system:
System Requirements and Instructions
1. Python 2
2. Internet connection (to access the API endpoint)
Step 1: Register on the Indico website (https://indico.io/pay-per-call) to obtain your own API key
Step 2: Enter the following command in the command line window to install the Indico Python client
Step 3: Download the repository from Github (https://github.com/IndicoDataSolutions/SuperCell). Unzip and enter the “matching clothes” directory
Step 4: Add the following code to the main.py file. Remember to replace YOUR_API_KEY with your own key obtained in Step 1
At the end, replace ‘if __name__ == “__main__”‘ with the following code
Enter the following command to run the code
You will get the following output:
This output indicates the probability of matching in the above example.
2. Open-source Applications of Deep Learning
▼
2.1 Music Production Using Deep Learning
Music production is one of the coolest applications of deep learning. The following application, if used properly, can lead to groundbreaking developments.
Like other things in nature, music is harmonious. Music has a pattern that we can capture and understand. These musical patterns can be learned by computers and used to generate new musical melodies. This is the principle behind music production.
This open-source application (https://deepjazz.io/) is built on this principle. Here is an example of the music it produces.
Visit the website to listen to the music (https://soundcloud.com/deepjazz-ai/deepjazz-on-metheny-128-epochs)
Now let’s replicate this result!
System Requirements:
1. Python (2 or 3)
Step 1: Install the associated software
First, install Theano. Make sure to install the latest version of Theano, which can be found here (http://deeplearning.net/software/theano/install.html#bleeding-edge-install-instructions).
Then install Keras with the following command:
Then follow the guide provided here (https://keras.io/backend/) to change the Keras backend from TensorFlow to Theano.
The last associated software is Music21. Refer to this (http://web.mit.edu/music21/doc/installing/index.html) link for installation.
Step 2: Run the following command to generate music
2.2 Detecting Not Safe For Work (NSFW) Images
Although censorship is a controversial topic, it remains an important part of filtering out offensive adult content for viewers. The following application focuses primarily on filtering out NSFW content and identifying pornographic images. The scores returned by the system indicate the tendency towards NSFW, thus filtering out images above a certain threshold.
Here are three predicted images and the NSFW scores given by the system.
Let’s see how to build such an application.
System Requirements:
1. Python 2
Step 1: Install docker (https://docs.docker.com/engine/installation/) on your system and create an image with the following command
Step 2: Download the repository from GitHub and unzip it (https://github.com/yahoo/open_nsfw)
Step 3: Run the following command in your download directory. Provide the path of the image you want to analyze
2.3 Super Resolution
We often see scenes in movies where an image is enlarged to reveal the finest details, leading to the capture of a criminal or the discovery of key evidence.
(Let us enhance)
But in reality, when you enlarge an image, it often becomes blurry. To address this issue (making dreams come true), we can use deep learning to improve image resolution, helping us achieve clear enlargements.
The following application is an implementation of the above scenario, and here is an example of the output.
Now let’s see how to build this application.
System Requirements
1. Python 3
Step 1: Install docker on your system
Step 2: Open the .bashrc file and enter the following code
Step 3: Now enhance your image by adding the image file name in the code below
3. Other Commonly Used Resources
▼
Deep learning continues to surprise us, and with the development of countless applications, various industries are competing to utilize this technology. Before concluding this article, I would like to list some resources that may inspire you.
Course material on “Applications of Deep Learning”
Projects done by students of Stanford’s CS231n ’16 batch
Projects done by students of Stanford’s CS224d ’16 batch
List of Deep Learning Startups
You can also watch the following videos that enrich our lives with deep learning. I hope you enjoy!
(deep learning simplified)
Conclusion
▼
I hope you enjoyed this article. Deep learning has fascinated everyone, including top data scientists. In this article, I shared several applications, and if you know of any other deep learning applications, please share them with us in the comments.
Original link:
https://www.analyticsvidhya.com/blog/2017/02/5-deep-learning-applications-beginner-python/
Previous Excellent Articles
Click the image to read the article
StackOverflow 60,000 Programmers Survey: Revealing Industry Salaries and Inside Jokes