Code for performing object recognition with the PC/BC-DIM algorithm.
 
 
Go to file
mwspratling 7c7daea1f5 1st release December 2016 2023-02-13 15:53:41 +00:00
ISMDIM_codebook_cars.mat 1st release December 2016 2023-02-13 15:53:41 +00:00
ISMDIM_codebook_carsScale.mat 1st release December 2016 2023-02-13 15:53:41 +00:00
LICENSE 1st release December 2016 2023-02-13 15:52:15 +00:00
README.md 1st release December 2016 2023-02-13 15:52:15 +00:00
best_subplot_rows_cols.m 1st release December 2016 2023-02-13 15:52:15 +00:00
calc_f1score.m 1st release December 2016 2023-02-13 15:52:15 +00:00
centroid.m 1st release December 2016 2023-02-13 15:52:15 +00:00
classify_images.m 1st release December 2016 2023-02-13 15:52:15 +00:00
convert_car_coordinates.m 1st release December 2016 2023-02-13 15:52:15 +00:00
convert_to_weights.m 1st release December 2016 2023-02-13 15:52:15 +00:00
cropimage.m 1st release December 2016 2023-02-13 15:52:15 +00:00
define_dictionary.m 1st release December 2016 2023-02-13 15:52:15 +00:00
dim_activation.m 1st release December 2016 2023-02-13 15:52:15 +00:00
dim_activation_conv_recurrent.m 1st release December 2016 2023-02-13 15:52:15 +00:00
dim_learn.m 1st release December 2016 2023-02-13 15:52:15 +00:00
distance_measure.m 1st release December 2016 2023-02-13 15:52:15 +00:00
extract_patch.m 1st release December 2016 2023-02-13 15:52:15 +00:00
extract_patches.m 1st release December 2016 2023-02-13 15:52:15 +00:00
figured.m 1st release December 2016 2023-02-13 15:52:15 +00:00
gauss2D.m 1st release December 2016 2023-02-13 15:52:15 +00:00
gauss3D.m 1st release December 2016 2023-02-13 15:52:15 +00:00
highest_integer_factors.m 1st release December 2016 2023-02-13 15:52:15 +00:00
imnorm.m 1st release December 2016 2023-02-13 15:52:15 +00:00
imsetsize.m 1st release December 2016 2023-02-13 15:52:15 +00:00
ismdim_matching.m 1st release December 2016 2023-02-13 15:52:15 +00:00
ismdim_training.m 1st release December 2016 2023-02-13 15:52:15 +00:00
ismdim_voting.m 1st release December 2016 2023-02-13 15:52:15 +00:00
isodd.m 1st release December 2016 2023-02-13 15:52:15 +00:00
iszero.m 1st release December 2016 2023-02-13 15:52:15 +00:00
load_classify_image_dataset.m 1st release December 2016 2023-02-13 15:52:15 +00:00
load_image_car.m 1st release December 2016 2023-02-13 15:52:15 +00:00
maxsubplot.m 1st release December 2016 2023-02-13 15:52:15 +00:00
normalise_dim_weights.m 1st release December 2016 2023-02-13 15:52:15 +00:00
odd.m 1st release December 2016 2023-02-13 15:52:15 +00:00
pad_to_make_odd.m 1st release December 2016 2023-02-13 15:52:15 +00:00
plot_RFPPI.m 1st release December 2016 2023-02-13 15:52:15 +00:00
plot_bounding_box.m 1st release December 2016 2023-02-13 15:52:15 +00:00
plot_codebook.m 1st release December 2016 2023-02-13 15:52:15 +00:00
plot_errors.m 1st release December 2016 2023-02-13 15:52:15 +00:00
plot_image.m 1st release December 2016 2023-02-13 15:52:15 +00:00
plot_misclassified.m 1st release December 2016 2023-02-13 15:52:15 +00:00
plot_precision_recall.m 1st release December 2016 2023-02-13 15:52:15 +00:00
plot_weights.m 1st release December 2016 2023-02-13 15:52:15 +00:00
postprocess_codebook.m 1st release December 2016 2023-02-13 15:52:15 +00:00
stats_ismdim_cars.m 1st release December 2016 2023-02-13 15:52:15 +00:00
stats_ismdim_carsScale.m 1st release December 2016 2023-02-13 15:52:15 +00:00
test_ismdim_cars.m 1st release December 2016 2023-02-13 15:52:15 +00:00
test_ismdim_carsScale.m 1st release December 2016 2023-02-13 15:52:15 +00:00
trimarray_symmetrically.m 1st release December 2016 2023-02-13 15:52:15 +00:00
weight_initialisation_random.m 1st release December 2016 2023-02-13 15:52:15 +00:00

README.md

This code implements the simulation results reported in:

M. W. Spratling (2017) A Hierarchical Predictive Coding Model of Object Recognition in Natural Images, Cognitive Computation, 9(2): 151-67.

Please cite this paper if this code is used in, or to motivate, any publications.


USAGE


This code was tested with MATLAB Version 9.0.0.341360 (R2016a) running on Ubuntu Linux version 16.04.

Simulations may run faster if you install the MATLAB function convnfft written by Bruno Luong, which is available here: http://www.mathworks.com/matlabcentral/fileexchange/24504-fft-based-convolution

The following MATLAB functions can be used to perfom the experiments described in the paper.

Fig. 2 can be reproduced using the command:

     classify_images('MNIST',4);
 Be warned this function requires about 25GB of free RAM to execute! If you
 don't have that much memory you can train a smaller network by using fewer
 training images, using the command: classify_images('MNISTXXXX',4); where
 XXXX=1000, 2000, 4000, or 5000. This number specifies the number of
 training images per class.

 To run this function you will need the MNIST dataset installed on your
 system, and you will need to edit the path in the file
 load_classify_image_dataset.m to point to the locations where this data is
 stored.

Fig. 3 can be reproduced using the command:

     classify_images('YALE1',1.25);
 To run this function you will need Extended Yale Face Database B installed
 on your system, and you will need to edit the path in the file
 load_classify_image_dataset.m to point to the locations where this data is
 stored.

Figs. 4 and 5 can be reproduced using the command:

     test_ismdim_cars(imageNum);
 where imageNum is the number of the image in the test set that is to be processed.

 The precision recall curve can then be generated by running:
     stats_ismdim_cars;
	 The previous two commands use the file ISMDIM_codebook_cars.mat which is
	 produced using the command:
		 ismdim_training('cars');
 To run this function you will need the UIUC cars dataset installed on your
 system, and you will need to edit the path in the file load_image_car.m to point
 to the locations where this data is stored.

Fig. 6 can be reproduced using the command:

     test_ismdim_carsScale(imageNum);
 where imageNum is the number of the image in the test set that is to be processed.

 The precision recall curve can then be generated by running:
     stats_ismdim_carsScale;
 The previous two commands use the file ISMDIM_codebook_carsScale.mat which
 is produced using the command:
     ismdim_training('carsScale');
 To run this function you will need the UIUC cars dataset installed on your
 system, and you will need to edit the path in the file load_image_car.m to point
 to the locations where this data is stored.