shackenberg / Minimal-Bag-of-Visual-Words-Image-Classifier

Implementation of a content based image classifier using the bag of visual words approach in Python together with Lowe's SIFT and Libsvm.
236 stars 94 forks source link

num = int(header[0]) # the number of features #8

Open edess opened 10 years ago

edess commented 10 years ago

Hello! Hope you're fine. Need a help.

I've been trying the all program, and I reach this error " num = int(header[0]) # the number of features".

Apparently, the problem comes from the module sift.py, and the fuction can't read the header[0] of my filename (which is BACKGROUND_Google/image_0001.jpg.sift).

Does anyone knows how the file xxxx.jpg.sift looks like? I tried to open it with Textedit and checked the sized, and I found out that it's empty (0 kb).

I wonder if the function ""read_features_from_file"" can work with an empty xxxx.jpg.sift? Is it normal to have xxxx.jpg.sift empty, since we want to extract the number of features from it?

here is a screenshot of the error

screen shot 2014-09-08 at 2 06 47 pm

Thanks in advance!!

edess commented 10 years ago

Hello everyone! I've been dealing with this problem about running the sample code. I think I got some clear points that I would like to share.

1) the sift executable coming in SiftDemoV4 is a 32 bits executable. so if you're using a 64 bits OS like me you should look for a Sift executable 64 bits (in my case I must use a Mach-O 64-bit executable x86_64). shackenberg said :"sift is a 32Bit executable and you need to install additional libraries to make it run on 64Bit systems" . It's true but I doesn't work always. (probably 'cause I use Mac)

2) When you find a sift 64 bits executables (I found and use the VLFEATROOT coming with a sift executable for Mac 64 ) you need to make a small change in the sift.py code (where the program check the os ). so cmmd = "./sift < " + imagename + " > " + resultname should be cmmd= "./VLFEATROOT/bin/maci64/sift /" + resultname +" " + imagename.

(the pipe should disappear and the imagename coming after the resultatname).

I hope these informations could help someone!

Thanks!!!

shackenberg commented 10 years ago

Hi edess,

thanks so much for your input. Sorry I could not be of more help. I am super busy at work atm.

Cheers Ludwig

edess commented 10 years ago

Thanks also Ludwig!!

I am still working on "Minimal-Bag-of-Visual-Words-Image-Classifier" to try add some more functions, that I will be glad to share again.

Btw, I am currently trying to plot the confusion matrix of the classifier. Do you have a clue about what file I should regard in to setup the parameters of the confusion function? (I mean which file between codebook.file and trainingdata.svm.model) ?

Thanks and good job at your working place!!!!!

Cheers, Elder