MatDeepRep: Deep representation learning tool for image classification with Matlab
Author: Grigorios Kalliatakis, University of Essex (firstname.lastname@example.org)
Copyright 2017, all rights reserved.
Licence: BSD (see COPYING file)
For decades, traditional machine learning systems demanded accurate engineering and significant domain expertise in order to design a feature extractor capable of converting raw data (such as the pixel values ofan image) into a convenient internal representation or feature vector from which a classifier could classify or detect patterns in the input. Today, representation learning methods and principally convolutional neural networks (CNNs) [LeCun et al., 1989] are driving advances at a dramatic pace in the computer vision field after enjoying a great success in large-scale image recognition and object detection tasks.
MatDeepRep is a Matlab plugin , built on top of Caffe framework, capable of learning deep representations for image classification using the BVLC caffe matlab interface (matcaffe) & various pretrained .caffemodel binaries.
Paper and Licencing
Details relating to the supporting paper can be found on my personal research page at:
If you use this code for your experiments, please cite:
G. Kalliatakis, S. Ehsan, M. Fasli, A. Leonardis, J. Gall and K. McDonald-Maier Detection of Human Rights Violations in Images: Can Convolutional Neural Networks help? Computer Vision, Imaging and Computer Graphics Theory and Applications, (VISAPP) Conference, 2017
A copy of the paper is available at:
This software is released under the BSD licence (refer to the COPYING file for details). This software is for learning purposes, and not meant for any use in production / commercial purposes. We are always interested in how this software is being used, so if you found this software useful or plan to make a release of code based on or using this package, it would be great to hear from you. Similarly, acknowledgements or citations to the above paper are appreciated.
The MatDeepRep function requires the Caffe deep learning framework (available from http://caffe.berkeleyvision.org/), which must be installed and accessible on the MATLAB path (you can follow my step-by-step guide here.
Next, all the latest deep ConvNet models must be downloaded in the required Caffe format from here. Please note they must be placed inside the default folder of the Caffe installation named 'models'. The safer option will be to extract the downloaded zip file inside the 'models' folder of the Caffe installation.
In addition, the datasets should be downloaded and stored in a directory of your choice. However, We must pay attention to the structure of the folders which will contain the raw jpg images. We will need 4 different folders: (1) positive training; (2) negative training; (3) positive test and (4) negative test. This happens in order to be able to evaluate both processes of training and testing in the end. The complete structure of the folder with the name 'datasets' (which needs to be inside the matlab/demo folder) is given by the following example:
datasets/ MINC2500/ POS_TRAIN/ leather/ 00001.jpg 00002.jpg ...
Usage & examples
Open Matlab and go to Caffe framework. Then add the current folder and subfolders to path. MatDeepRep must be placed and ran from inside the demo folder which can be located inside matlab folder.
The following command will extract fetrures using the ResNet50 model and FMD dataset for the fabric category:
[code,code_v] = matdeeprep('ReseNet50', 'FMD', 'fabric');
You can modify the command according to your needs in order to learn deep features representations for any given dataset.
The final step would be to evaluate your system by feeding the extracted features to a linear SVM classifier, which is beyond the scope of this repository.
Question and Comments
If you would like to file a bug report or a feature request, use the Github issue tracker.