arXiv(opens in a new tab)Computer ScienceDec 2014

Manuscript Offprint

arXiv:1412.4564

MatConvNet: Convolutional Neural Networks for MATLAB

A. Vedaldi, Karel Lenc

Abstract

MatConvNet is an implementation of Convolutional Neural Networks (CNNs) for MATLAB. The toolbox is designed with an emphasis on simplicity and flexibility. It exposes the building blocks of CNNs as easy-to-use MATLAB functions, providing routines for computing linear convolutions with filter banks, feature pooling, and many more. In this manner, MatConvNet allows fast prototyping of new CNN architectures; at the same time, it supports efficient computation on CPU and GPU allowing to train complex models on large datasets such as ImageNet ILSVRC. This document provides an overview of CNNs and how they are implemented in MatConvNet and gives the technical details of each computational block in the toolbox.

Chapter 0 Introduction to MatConvNet

MatConvNet is a MATLAB toolbox implementing Convolutional Neural Networks (CNN) for computer vision applications. Since the breakthrough work of [7], CNNs have had a major impact in computer vision, and image understanding in particular, essentially replacing traditional image representations such as the ones implemented in our own VLFeat [11] open source library.

While most CNNs are obtained by composing simple linear and non-linear filtering operations such as convolution and rectification, their implementation is far from trivial. The reason is that CNNs need to be learned from vast amounts of data, often millions of images, requiring very efficient implementations. As most CNN libraries, MatConvNet achieves this by using a variety of optimizations and, chiefly, by supporting computations on GPUs.

Numerous other machine learning, deep learning, and CNN open source libraries exist. To cite some of the most popular ones: CudaConvNet, Torch, Theano, and Caffe. Many of these libraries are well supported, with dozens of active contributors and large user bases. Therefore, why creating yet another library?

The key motivation for developing MatConvNet was to provide an environment particularly friendly and efficient for researchers to use in their investigations. MatConvNet achieves this by its deep integration in the MATLAB environment, which is one of the most popular development environments in computer vision research as well as in many other areas. In particular, MatConvNet exposes as simple MATLAB commands CNN building blocks such as convolution, normalisation and pooling (chapter 3); these can then be combined and extended with ease to create CNN architectures. While many of such blocks use optimised CPU and GPU implementations written in C++ and CUDA (section section 4), MATLAB native support for GPU computation means that it is often possible to write new blocks in MATLAB directly while maintaining computational efficiency. Compared to writing new CNN components using lower level languages, this is an important simplification that can significantly accelerate testing new ideas. Using MATLAB also provides a bridge towards other areas; for instance, MatConvNet was recently used by the University of Arizona in planetary science, as summarised in this NVIDIA blogpost.

MatConvNet can learn large CNN models such AlexNet [7] and the very deep networks of [9] from millions of images. Pre-trained versions of several of these powerful models can be downloaded from the MatConvNet home page. While powerful, MatConvNet remains simple to use and install. The implementation is fully self-contained, requiring only MATLAB and a compatible C++ compiler (using the GPU code requires the freely-available CUDA DevKit and a suitable NVIDIA GPU). As demonstrated in fig. 1 and section 1, it is possible to download, compile, and install MatConvNet using three MATLAB commands. Several fully-functional examples demonstrating how small and large networks can be learned are included. Importantly, several standard pre-trained network can be immediately downloaded and used in applications. A manual with a complete technical description of the toolbox is maintained along with the toolbox. These features make MatConvNet useful in an educational context too.

MatConvNet is open-source released under a BSD-like license. It can be downloaded from http://www.vlfeat.org/matconvnet as well as from GitHub..

References (9)

  • Return of the devil in the details: Delving deep into convolutional nets
  • Li, K. Li, and L. Fei-Fei
  • Batch normalization: Accelerating deep network training by reducing internal covariate shift
  • Imagenet classification with deep convolutional neural networks
  • Network In Network
  • Deep inside convolutional networks: Visualising image classification models and saliency maps
  • Very deep convolutional networks for large-scale image recognition
  • VLFeat – An open and portable library of computer vision algorithms
  • Visualizing and understanding convolutional networks