Caffe Faster R-CNN on Microsoft Azure Cloud
Few months back I was working on an object detector to identify (detect the bounding box and classify) around hundred custom objects. On implementing various algorithms including YOLO, R-FCN and evaluating other commercial object detectors, Faster R-CNN proposed by Ross Girshick (code, paper) suited my requirements including memory and speed and I was able to achieve 94% recall. That was the good part and I thought all the hard work is done! But my troubles started when I wanted to deploy it on the cloud and create simple REST API end points. I thought it would be an easy one day job. It ended up taking two weeks! After a lot of effort fixing different compiling and linking issues , now I have the recipe to accomplish it in a couple of hours. Hope this will be useful to you.
I chose Microsoft Azure platform for the ease of creating REST API and because they have pre-configured deep learning GPU virtual machine called Deep Learning Virtual Machine (DLVM) (more details here). It comes with pre-installed deep learning frameworks like Caffe, Microsoft CNTK, Keras and Tensorflow. But running Caffe R-CNN on this DLVM was not straight forward. The whole process is explained in the following two parts:
Part 1: Create an Azure DLVM cloud GPU instance
Part 2: Configure Faster R-CNN on Azure DLVM GPU instance
Part 1: Create an Azure DLVM cloud GPU instance
Below are steps to create an Azure Cloud GPU instance with pre-built deep learning frameworks.
- Login to https://portal.azure.com
- In the left pane click on “Create a resource”
3. Type DLVM in the search box and choose Deep Learning Virtual Machine as shown below.
4. Next step is to configure the DLVM. All the fields are self explanatory. For running Caffe R-CNN you need to choose Linux as your OS. It is better to “Create new” resource group and give a relevant name. This will make future VM management easy.
5. There are different virtual machine configurations available in NC and ND series. You can choose your configuration based on the number of CPUs, GPUs (Nvidia K80, P40 and P100 are available) and storage requirements. Complete list of options can be found here.
5. Once the configuration is selected, confirm the storage account and click “Create” button to spawn a new virtual machine. It may take an hour or two for the VM to be ready.
6. Once the VM is ready, you will find the IP address of the virtual machine by clicking on the resource group and then on the virtual machine.
6. You can ssh to this IP address or use X2Go for remote graphical user interface. When using X2Go client, make sure you select XFCE in “Session Type”. Other options may not work.
This completes spawning an Azure DLVM. Click below link for details on configuring the DLVM for training and inference using Caffe Faster R-CNN.