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

"No such file or directory" Error in sift.py #3

Closed shackenberg closed 11 years ago

shackenberg commented 11 years ago

I run learn.py with the Caltech101 dataset, but I get follwowing error message:

calculating sift features for ./101_ObjectCategories/Faces/image_0285.jpg
working on  ./101_ObjectCategories/Faces/image_0285.jpg
./sift <tmp.pgm>./101_ObjectCategories/Faces/image_0285.jpg.sift
Traceback (most recent call last):
  File "learn.py", line 119, in <module>
    cat_features = extractSift(cat_files)
  File "learn.py", line 50, in extractSift
    sift.process_image(fname, features_fname)
  File "/home/my/Desktop/MBVWIC/sift.py", line 42, in process_image
    if os.path.getsize(resultname) == 0:
  File "/usr/lib/python2.7/genericpath.py", line 49, in getsize
    return os.stat(filename).st_size
OSError: [Errno 2] No such file or directory: './101_ObjectCategories/Faces/image_0285.jpg.sift'

But when I check the file image_0285.jpg.sift does exist.

shackenberg commented 11 years ago

The problem was caused by os.system(cmmd), which does not wait till the process finishes till it returns. Now replaced with subprocess.call(cmmd, shell=True).

edess commented 10 years ago

Hello ! Hope you're fine. Sorry to re-open this issue

I'm facing the same errors despite the update of subprocess.call(cmmd, shell=True). here is the screenshot .

screen shot 2014-08-27 at 11 42 08 am

problem: when I check the file image_0001.jpg.sift does exist.

Please, help me!

shackenberg commented 10 years ago

Hi Edess,

can you try to change this line https://github.com/shackenberg/Minimal-Bag-of-Visual-Words-Image-Classifier/blob/master/sift.py#L93

to:

if exists(filename) is False | os.path.getsize(filename) == 0:

If this fixes your problem I will change it in the repo.

edess commented 10 years ago

Hi shackenberg ,

I did as you said and changed " if exists(filename) != False | os.path.getsize(filename) == 0: " by " if exists(filename) is False | os.path.getsize(filename) == 0: "

And this yield to another error. here is the screenshot. screen shot 2014-08-29 at 5 09 01 pm

Actually, I found the same error when I was trying to find a solution (At that time, I made this like a comment """ if exists(filename) != False | os.path.getsize(filename) == 0: raise IOError("wrong file path or file empty: "+ filename)"""

Do you have any idea about the problem?

shackenberg commented 10 years ago

Sorry, no. I would have to try it out myself. But I probably wont have time in the next two or three weeks for that. :-(

But can you open a new issue, so that the issues don't get mixed up too much?

edess commented 10 years ago

Okay! Thanks!

I also opened a new issue today (issue number 7)