Now, as you have got some insights into deep learning, let us get an overview of what is Caffe.
Training a CNN
Let us learn the process for training a CNN for classifying images. The process consists of the following steps −
-
Data Preparation − In this step, we center-crop the images and resize them so that all images for training and testing would be of the same size. This is usually done by running a small Python script on the image data.
-
Model Definition − In this step, we define a CNN architecture. The configuration is stored in .pb (protobuf) file. A typical CNN architecture is shown in figure below.
-
Solver Definition − We define the solver configuration file. Solver does the model optimization.
-
Model Training − We use the built-in Caffe utility to train the model. The training may take a considerable amount of time and CPU usage. After the training is completed, Caffe stores the model in a file, which can later on be used on test data and final deployment for predictions.
What’s New in Caffe2
In Caffe2, you would find many ready-to-use pre-trained models and also leverage the community contributions of new models and algorithms quite frequently. The models that you create can scale up easily using the GPU power in the cloud and also can be brought down to the use of masses on mobile with its cross-platform libraries.
The improvements made in Caffe2 over Caffe may be summarized as follows −
- Mobile deployment
- New hardware support
- Support for large-scale distributed training
- Quantized computation
- Stress tested on Facebook
Pretrained Model Demo
The Berkeley Vision and Learning Center (BVLC) site provides demos of their pre- trained networks. One such network for image classification is available on the link stated herewith and is depicted in the screenshot below.
In the screenshot, the image of a dog is classified and labelled with its prediction accuracy. It also says that it took just 0.068 seconds to classify the image. You may try an image of your own choice by specifying the image URL or uploading the image itself in the options given at the bottom of the screen.