File Exchange

image thumbnail

Scenes/Objects classification toolbox

version 1.2 (19.5 MB) by

Scenes recognition toolbox for vision systems

7 Ratings



View License

Scenes/Objects Rocognition toolbox v0.12
This toolbox provides some basic tools for scenes/object recognition in vision systems.
Based on supervised classification, this toolbox offerts some state-of-art descriptors coupled with fast and efficient classifiers.
Descriptors are divided in two famillies:
i) "direct" features computed from images [1,2,3,4,5,19],
ii) "dictionnary learning + spatial pooling" features computed from a collection of patches:
    a) Bag of Features [6,7] and
    b) Sparse Dictionary learning [8,9].
Large-Scale Linear SVM such Liblinear [10] or Pagasos [11] are used to train models since features are almost perfectly linearly separable.
Non-linear Kernels extension for additive homogeneous kernels (chi2, intersection histogram, etc...) is performed through features map method [12,22].
The main objective of this toolbox is to deliver simple but efficient tools, easy to modify, mainly written in C codes with a matlab interface.

Please open readme.txt for full instructions

Comments and Ratings (26)


jinting zhu

Hi,Sébastien,is it the dltrain.c missing ?


arash (view profile)

thanks for your excellent work,but please update this to the new version as you said on 2013.

Dear Sebastien, Can you please guide me how to use this excellent toolbox to classify the medical image into two classes : abnormal and normal ? Thanks in advance.

Sebastien PARIS


With this toolbox and the totally new version that I hope to publish within 1 month, you can retrieve results of more that 50 papers in image categorization...

Ranju Mandal

Dear Sebastien, Can you please send me the link of the paper where u have described the method in details?

a das

a das (view profile)

hi can you say me when I am running the code simple_train.m its giving a error undefined variable X. Can pls solve it????

Sebastien PARIS

Zbingos... How big is your dataset ?. How many images?. In my current version now everything is passing trough a file so requiering low memory for a just a slight slowdown ..


A> choice_descriptors = [1]; %mlhoee_spyr=1/mlhmslsd_spyr=2/mlhmslbp_spyr=3/mlhmsldp_spyr=4

a> case [2]:
Subscripted assignment dimension mismatch.

Error in extract_direct_features (line 85)
                X(: , co) = descriptors(I ,

b> case [1]:
Crash out of memory (maybe cause i run it in a 32bit matlab ?)

B> You have right i did not extract the proper descriptor.

Thanks a lot and sorry for the delay in replying.

Sebastien PARIS


The version of the toolbox is old compare to my current one. I have to update it I know ... but have to spend of time to check compatibility, debugging etc... In the new version you have

i) New local features: HLBP/HLTP/DV, etc..
ii) New encoders/pooler: LCC, Local sparse coding, Fisher vector, lp-norm pooling
iii) cascade up to 3 layers
iv) cross-training capacity

Everything have been redesign completly compared to the current one...

Actually I don't have time to do this update, hope within 1 month... Please understand.
To asnwer to your question:
1) what are the 1 et 2 choices ?

2) norm is a vector (1 x 3). norm(1) for the all concatenated vector, norm(2), for all current level of the pyramid, norm(3) for each individual ROI where you are pooling

3) Did you extract first the corresponding descriptor ?


Hi sebastian,

1. I can not run the "extract_bag_of_features" for the "1" and "2" choice of descriptors. ?

2. Some demo m files does not run so i change the norm from number to matrix e.g: [1,0,0]. Is it right or not?

3. The simple_train.m does not run. The error is this:
Load descriptor scenes15_denseSIFT_mlhbow_spyr for classifier = liblinear

Error using load
Unable to read file 'C:\C_DISC\codes\KARA\3
reco_toolbox\reco_toolbox\features\scenes15_denseSIFT_mlhbow_spyr': no such file or

Error in simple_train (line 145)
        load(fullfile(feat_dir , base_name ));

Thanks for your help~time.


Leila (view profile)

Hi Sébastien, Thanks for the info! But I did not notice any major changes to the ldp code... Are there traumatic differences?


Weixia (view profile)

Dear Sebastian,
Thank you for sharing this remarkable toolbox!
I've just installed the toolbox and run the bag_of_features.m, but unfortunately, en error was reported. It said that "Undefined function 'dltrain' for input argument of type 'struct'."
Error in extract_bag_of_features (line 229)
                    D(: , : , s , c) = encoding(X(: , indexdico) ,

Could you please so kind to help me with this little problem? I am really an new hand in this area...
Best wishes!


Weixia (view profile)

Sebastien PARIS


1) For large database, I'll plan to use the new functionalities of Matlab 2011b to append/load partially from a file.

2) It's a good idea to separate the datasets. I'll make the modification in the incoming major update of this toolbox

Venkat R

Dear Sebastian,
I was using your extract_bag_of_features.m for my object classification. If possible, can you help me in following problems I am facing...
1. For a database of size 50,000 samples, there is Out of memory problems coming...
2. Can I use the dictionary built on one database, for encoding another database(s). I will normalize all images to a standard size of 50x50 and keep the SIFT parameters also the same.

thanking you,

with regards,

Sebastien PARIS


I am working on a big update of this toolbox with a lot of new things, stay in touch so ...

Sebastien PARIS


Please visit the SPAMS webpage (, compile the lib with your current system and copy the associate requiered files such mexlasso, mexTrainDL, mexTrainDLmemory in the /core dir of my toolbox

Ishrat Badami

Dear Sebastian,
I installed the toolbox as instructed on Ubuntu 10.04 32bit. While running the file extract_bag_of_features.m I get error message
??? Invalid MEX-file
'/home/ishrat/Uni_Bonn/Semester_2/Graphics_2/graphics_lab/Matlab/reco_toolbox/core/mexLasso.mexglx': cannot open shared object file: No such file or directory.

Error in ==> dl_spyr at 77
        G = full(abs(mexLasso(X(: , index) , D(: , : , s , c) ,
        options)))'; %(np x K)
I also unzip the in core folder. Am I missing something? Please help I am totally stuck.
Thanks in advance


Leila (view profile)

yes, one for each derivative direction. I could output the one for 0 degrees.

Sebastien PARIS


There are in fact 4 LDP images ...
Maybe I will add an option for display them.


Leila (view profile)

Hi again. Thank you for your answer. Assuming one would like to see the LDP image, is there a way to output it using your function, or a variable in your function? Thanks!

Sebastien PARIS

Leila. This normalization is often used in computer vision. See Maji'papers for example.


Leila (view profile)

Dear Sébastien,
Thanks for your answer. I have another question: in the normalization type 3, you normalize the square of the L1 norm, why?

Sebastien PARIS

I use the same convention than in the Zhang paper.

ldporient Orientation for ldp computation (1 x norient), where norient <= 4 and ldporient(i) = {0,1,2,3}
ldporient(i) = 0 <=> (I(x_1+1,y_1)-I(x_1,y_1))*(I(x_0+1,y_0)-I(x_0,y_0))< 0
ldporient(i) = 1 <=> (I(x_1+1,y_1+1)-I(x_1,y_1))*(I(x_0+1,y_0+1)-I(x_0,y_0))< 0
ldporient(i) = 2 <=> (I(x_1,y_1+1)-I(x_1,y_1))*(I(x_0,y_0+1)-I(x_0,y_0))< 0
ldporient(i) = 3 <=> (I(x_1-1,y_1+1)-I(x_1,y_1))*(I(x_0-1,y_0+1)-I(x_0,y_0))< 0
(default ldporient = [0 , 1 , 2 , 3])



Leila (view profile)

Dear Sébastien,
Thanks for this helpful code.
Where you specify ldporient, how do (x_1,y_1) and (x_0,y_0) correspond to neighborhood pixels in the original paper [Zhang et al, 2010]?



0.12 - Add new normalization method.
- Better default parameters which improve results.
- Better databases handling.
- Add "triangle" soft assignement for K-means dictionary learning approach [21]


-Compile SPAMS with -largeArrayDims flag for WIN64 system
-Can handle any many databases where images per topics are in a specific folder with specific config files
- Read readme.txt for a complete of changes

MATLAB Release
MATLAB 7.9 (R2009b)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video