打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
5 More Deep Learning Applications a beginner can b...

Introduction

Deep Learning is fundamentally changing everything around us. A lot of people think that you need to be an expert to use power of deep learning in your applications. However, that is not the case.

In my previous article, I discussed 6 deep learning applications which a beginner can build in minutes. It was heart-warming for me to see hundreds of readers getting motivated by it. So I thought of following up from my previous article with a few more applications of deep learning. If you missed out on my previous article, I would suggest you should go through it.

In this article, we will learn how to build applications like automatic image tagging, apparel recommendation, music generation using deep learning and many more. And you will be able to build any of these applications with in minutes!

P.S. The article assumes, you know the basics of Python. If not, just follow this tutorial and then you can start from here again.

 

Table of Contents

1. Applications using existing APIs

  1. Automatic Image Tagging with Clarifai API
  2. Apparels Recommender with Indico API

2. Open Sourced Applications

  1. Music Generation using Deep Learning
  2. Detecting “Not Safe For Work” Images
  3. Super Resolution

3. Other Notable Resources

 

1. Deep learning Applications using existing API

1.1 Automatic Image Tagging (Clarifai API)

Image tagging is one of the first applications of deep learning that showed breakthrough results. Unlike textual data, an image is a lot harder to comprehend for a machine. The machine requires a deeper understanding of the pixel data. Therefore we use image tagging to essentially summarize the image and tell us which categories the image and its underlying objects belong to.

That’s why we use image tagging to essentially summarize the image. This tells us which categories the image belongs to and what are its underlying objects.

Below is an example of predicted tags given to an image which was found through deep learning.

Now, let us look at how to build the above tagging feature for every image using an API provided by Clarifai.

Requirements and Specifications

  1. Python (2 or 3)
  2. Internet connection (for accessing API endpoint)

 

  • Step 1: Register on Clarifai website and get your own API key. You can then find your API credentials on the developer page

 

  • Step 2: Install Clarifai client for python by going to the terminal and typing
pip install clarifai

 

  • Step 3: Configure your system with Clarifai client
clarifai config

Here,  you will be asked to provide your Client ID and Client Secret respectively. You can find these on the developer page itself.

 

  • Step 4: Now create a file “application.py” and insert the code below to tag the image. Remember to replace in the code with the path of the image you want to tag.
from clarifai.rest import ClarifaiAppapp = ClarifaiApp()app.tag_files(['.jpg'])

Then run the code by

python application.py

You will get an output as follows

{ 'status': { 'code': 10000, 'description': 'Ok' }, 'outputs': [ { 'id': 'ea68cac87c304b28a8046557062f34a0', 'status': { 'code': 10000, 'description': 'Ok' }, 'input': { 'id': 'ea68cac87c304b28a8046557062f34a0', 'data': { 'image': { 'url': 'https://samples.clarifai.com/metro-north.jpg' } } }, 'data': { 'concepts': [ { 'id': 'ai_HLmqFqBf', 'name': 'train', 'app_id': null, 'value': 0.9989112 },...

This is a json output showing a response of the prediction. Here, you can find the relevant tags in outputs->data-> concept->name .

 

1.2 Apparels Recommender (Indico API)

Recommendation systems are becoming a great asset day by day. As the number of products is increasing, intelligently targeting specific consumers who would be willing to buy the product is essential. Deep Learning can help us in this genre too!

I am not a fashion buff, but I have seen people “waste” so much time choosing which clothes to wear. How great would it be if we could have an artificial agent know our preferences and suggest us the perfect outfit!

Fortunately, with deep learning this is possible.

You can find a demo of this application here.

The official article describes this in more detail. Now let’s find out how can you build this recommender system at your end.

Requirements and Specifications

  1. Python 2
  2. Internet connection (for accessing API endpoint)

 

 

  • Step 2: Install Indicoio client for python by going to command prompt and typing
pip install indicoio

 

  • Step 3: Download the repository from Github (here’s the link), extract it and go to “matching_clothes” folder.

 

  • Step 4: Now in the “main.py” file, insert the code below. Remember to replace YOUR_API_KEY with your own which you got in step 1.
import indicoiofrom indicoio.custom import Collectionindicoio.config.api_key = 'YOUR_API_KEY'

And at the end, replace the part ‘if __name__ == “__main__”‘ with below code

if __name__ == '__main__': train = generate_training_data('clothes_match_labeled_data_1.txt') collection = Collection('clothes_collection_1') for sample in tqdm(train): print sample collection.add_data(sample) collection.train() collection.wait()

And run this code by

python main.py

You will get an output like this

{u'label1': 0.0183739774, u'label2': 0.8100245667, u'label3': 0.1102390038, u'label4': 0.060105865800000005, u'label5': 0.0012565863}

which shows the probability of match as shown in the example above.

 

2. Open Source Deep Learning Applications

2.1 Music Generation using Deep Learning

Music generation is one of the coolest applications of deep learning. If this application is used meticulously, it can bring breakthroughs in the industry.

Music, just like most of the things in nature, is harmonic. It has patterns which our mind catches and makes sense of. These patterns of music can be taught to a computer and then can be used to create new music rhythms. This is the formula behind music generation.

This open source application was built keeping in mind this concept. Below is an example of what it could generate.

Now let’s look at how we can replicate the results!

Requirements:

  1. Python (2 or 3)

 

  • Step 1: Install the dependencies

First, install Theano. Note that you have to install the bleeding edge version of Theano, which is required for this. You can find the installation instructions here.

Then install Keras by the below code

pip install keras

You would have to change backend of Keras from tensorflow to Theano. Follow the instructions given here.

The final dependency is of Music21. For installation, refer this link.

 

  • Step 2: Now create music by running the below command
python generator.py 128

 

2.2 Detecting “Not Safe For Work” Images

Although censorship is indeed a controversial topic, it is still a vital component for filtering out offensive adult content from the viewers. The inventors of this application focused on filtering out one of the main type of NFSW content, identification of pornographic images. A score is returned, which shows the intensity of NFSW, which can be used to filter out images above a certain threshold.

Below shows the images and their corresponding NFSW score as given by the application.

Let’s look at how to build one such application

Requirements:

  1. Python 2

 

  • Step 1: Install docker in your system and build an image using command below
docker build -t caffe:cpu https://raw.githubusercontent.com/BVLC/caffe/master/docker/standalone/cpu/Dockerfile

 

  • Step 2: Download repository from Github and extract it (here’s the link)

 

  • Step 3: Go to your downloaded folder and run the below command in terminal. Give path of the image you want to analyze.
docker run --volume=$(pwd):/workspace caffe:cpu python ./classify_nsfw.py --model_def nsfw_model/deploy.prototxt --pretrained_model nsfw_model/resnet_50_1by2_nsfw.caffemodel .jpg

 

2.3 Super Resolution

We often see in movies that when you zoom in to an image, you can view even the finest detail which can be used to catch a criminal or get a crucial evidence.

In reality, this is not the case.When you zoom in, the image often gets blurry and not much can be seen. To cope up with this (and to make the dream a reality), we can use deep learning to increase the resolution of an image, which can help us to get clarity on zooming in.

This application is the depiction of the same. Here is its sample output.

Now let’s look at how to build this

 

Requirements

  1. Python 3

 

  • Step 1: Install docker in your system.

 

  • Step 2: Open the .bashrc file and write the below line of code
alias enhance='function ne() { docker run --rm -v '$(pwd)/`dirname ${@:$#}`':/ne/input -it alexjc/neural-enhance ${@:1:$#-1} 'input/`basename ${@:$#}`'; }; ne'

 

  • Step 3: Now to enhance your image, just insert the name of your image in the below code
enhance --zoom=1 --model=repair .jpg

 

3. Other Notable Resources

Deep learning constantly amazes me. With countless applications in the making, the race for making use of this technology is becoming rampant in the industry. Before signing off, I would like to mention some of the resources which might be inspirational to you.

You can also look at the video below for some use cases where deep learning can be used to enrich our lives. Enjoy!

 

End Notes

I hope you enjoyed reading this article. Deep Learning continues to fascinate everyone including top data scientists across the globe.  These are few of the interesting applications I wanted to share with you. If you happen to know any other deep learning application, do share it with me in the comments section.

If you come across any queries while building these applications at your end. Post your questions below & I’ll be happy to answer them.

Learn, compete, hack and get hired!

Related

My playlist - Top YouTube Videos on Machine Learning, Neural Network & Deep Learning

Introduction One of the best way to get better at machine learning and deep learning is to watch a lecture from an expert and work your way along with it. If you do so, you get the best of both the worlds - you learn from the experts across the…

July 8, 2015

In 'Business Analytics'

6 Deep Learning Applications a beginner can build in minutes (using Python)

Introduction Deep Learning has been the most researched and talked about topic in data science recently. And it deserves the attention it gets, as some of the recent breakthroughs in data science are emanating from deep learning. It's predicted that many deep learning applications will affect your life in the near…

February 9, 2017

In 'Deep Learning'

21 Deep Learning Videos, Tutorials & Courses on Youtube from 2016

Introduction Until a few years back, deep learning was considered of a lesser importance as compared to machine learning. The emergence of neural networks & big-data has made various tasks possible. Back in 2009, deep learning was only an emerging field and only a few people recognized it as fruitful area…

December 13, 2016

In 'Machine Learning'

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
12本深度学习书籍推荐:有入门,有深度
The Ones ——深度学习框架 Keras 作者出书
7 Free eBooks every Data Scientist should read in 2020
这5种工具可以帮你开发属于自己的人工智能
Introduction to DeepDetect
【干货】Deep learning library featuring a higherlevel ...
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服