Machine Learning is quite a buzzword these days and we have witnessed how quickly Microsoft and other vendors have made progress in this area. Just a couple of years back, Microsoft had no product or tool in this space, and today, they have closer to a dozen. Recently, Microsoft has integrated Machine Learning into SQL Server and Dynamics CRM. It is slowly becoming core to its product line.

I would not be surprised if machine learning becomes a mandatory skill for most of the development jobs in the next decade.

How can Image Recognition help CRM?

Attaching documents is a common feature asked for in many CRM projects where customers can complete an application form and then upload scanned copies to support their application. Think of invoices, receipts, certificates, licenses, etc. As of now, there is no way that Dynamics CRM can detect if the scan that a customer is uploading is a picture of a license, or beach or a car.

What if Dynamics CRM can detect and recognise the scanned image and tell the user that it is expecting a license not a Dilbert on the beach?

Dynamics CRM Image Recognition Using Deep Learning

Source: Ol.v!er [H2vPk] – Flickr

Wouldn’t it be great?

Although there are some image engines that can tell you what an uploaded picture contains, there isn’t any engine or tool (as per my knowledge) that can tell whether an uploaded document is a license or not. This is because there are only subtle differences between scanned copies of various documents.

In this blog series, I will build and demonstrate an approach to have this kind of image recognition capability with our favourite Dynamics CRM, and we will use a branch of machine learning called Deep Learning that is very good at tasks related to Computer Vision. I would not be delving into the concepts of Deep Learning (there are numerous posts and videos on the internet), but I will try to cover the major building block in this whirlwind tour.

Australian Identity Documents

I will take a real business case which is ubiquitous in many online applications in Australia where a customer is asked to provide a scan of their Australian ID as a proof. For our blog, we will use the following Australian IDs.

  1. Victoria Driver’s License

VicRoads driver's license

  1. Australian Visa

australian visa

  1. Medicare card

medicare card

Note: Because of their sensitive nature I would only be exposing sample documents in this blog.

The expectation is that, the system can tell if the user is attaching a scanned copy of their Australian Visa when the record type is Australian Visa. So we will validate the image based on its content.

Good thing about deep learning based systems is that the detection algorithms do not rely on exact colour, resolution and placement but rather on pattern and feature matching. I got pretty good results when I built this system which I will share in later posts.

Technical Setup

Deep Learning based systems use a concept of neural networks to train themselves and to perform their tasks. There are many kinds of neural networks and the one that does the job for us is the Convolutional Neural Network. CNNs are good at image related tasks.

In order to train a CNN from scratch, you need a lot of hardware and computing power and I do not have that. So I will be using a partially trained network and customise it for our specific task, i.e. to identify the images of those 3 types of Australian IDs.

Let us cover the building blocks of our solution

TensorFlow – An open source framework for Deep Learning, and we will be using it to train our engine.

Python – TensorFlow comes in many platforms, but we will use its Python version.

Dynamics 365 – Once our model is trained, we will deploy it online as web service and CRM can query that.

This will be a three-part series, and in the next two parts, we will  see how to train this engine using TensorFlow and use it.

Stay tuned for the next two installments.