HumanSignal / labelImg

LabelImg is now part of the Label Studio community. The popular image annotation tool created by Tzutalin is no longer actively being developed, but you can check out Label Studio, the open source data labeling tool for images, text, hypertext, audio, video and time-series data.
https://youtu.be/p0nR2YsCY_U
MIT License
22.51k stars 6.27k forks source link

Not recognizing valid image files #176

Closed Elizabethcase closed 6 years ago

Elizabethcase commented 6 years ago

Hi,

I was using label img successfully until I recently pulled down updates (it had been a while). Now it can't open an image directories, and I get the error:

"Make sure /Users/elizabeth/Pictures/GoPro/2017-07-31/HERO5 Black 1/Time Lapse 1/G0016365.JPG is a valid image file."

Tried removing and reinstalling everything.

Help?

tzutalin commented 6 years ago

Hi @Elizabethcase , I am not sure about the root cause. Could you help me to do a test?
Move that image to another folder without space or special characters, then try to open the image again. If solved, the problem might be about decoding the image path in the wrong format.

Elizabethcase commented 6 years ago

Hi @tzutalin,

Ah sorry, yes. I've tried with different images/file formats/locations. Unfortunately I'm getting the same error for all of them. I can't open any image directly and it throws the same error for every directory.

Anything else I might be able to try?

tzutalin commented 6 years ago

Hi @Elizabethcase , That's wired. So far, I cannot know the cause. Adding a log to the below lines is the alternative way to get more insights: https://github.com/tzutalin/labelImg/blob/f4d87a9951b067d5719f5ffaeed211b5329d502b/labelImg.py#L901 https://github.com/tzutalin/labelImg/blob/f4d87a9951b067d5719f5ffaeed211b5329d502b/labelImg.py#L907

Elizabethcase commented 6 years ago

How do you add a log?

tzutalin commented 6 years ago

@Elizabethcase , You can add a log by using print() or log library. Using print() is easier.

In the meantime, you can try to download and reinstall again to see if the issue will happen or not.

tzutalin commented 6 years ago

@Elizabethcase , Do you resolve it?

bobhaffner commented 6 years ago

Hi @tzutalin thanks for building this awesome tool. I'm getting the same error as @Elizabethcase

OSX Sierra Python 2.7 and pyqt 4.11.4 I followed the setup outline here https://github.com/tzutalin/labelImg/issues/141

image

I looked at the lines you provided above. Not sure why the error description doesn't show in the error dialog box like it's implied in the code block below.

except LabelFileError as e:
                    self.errorMessage(u'Error opening file',
                                      (u"<p><b>%s</b></p>"
                                       u"<p>Make sure <i>%s</i> is a valid label file.")
                                      % (e, unicodeFilePath))
Elizabethcase commented 6 years ago

@bobhaffner just below that is the corresponding error

Not sure if you're doing this in a conda environment but for whatever reason (that I can't figure out), I got labelimg working with pyqt5 and python 3 only outside the environment. Previously, I always ran it within an environment. Thinking it must be a path thing because some searching shows that qt4 was bugging out with jpgs for a while, but I'm not fluent enough to suss out the exact solution.

Elizabethcase commented 6 years ago

@tzutalin I did, but I honestly don't know why doing it inside vs. outside a conda environment with all the required packages installed made a difference.

Thanks for your help & responsiveness!

bobhaffner commented 6 years ago

Hi @Elizabethcase I don't think I follow you on the error thing. I'm thinking it should appear on the line that's currently blank between Error opening file and Make sure...

I am using a conda env. That's interesting. Come to think of it, I did read a blog post that mentioned the same thing about jpegs

xinario commented 6 years ago

I came across the same problem within conda environment. I'm using OSX Sierra Python 2.7 and pyqt4. After some search, I found this thread. Basically, the problem lies in pyqt4 and they are not going to add support to jpeg.

So my solution is just switching to python 3 with pyqt5. Hope it helps.

bobhaffner commented 6 years ago

So my solution is just switching to python 3 with pyqt5. Hope it helps.

Same here @xinario. I was able to install everything thru conda

vdalv commented 6 years ago

Looks like this issue has been resolved. If not, please feel free to reopen.

Thanks,

-Vlad

Stern-Hayat commented 5 years ago

Hello, I'm getting the same error as @bobhaffner and @Elizabethcase now. In case of me, labelImg doesn't work well even if I switch versions to python3 and pyqt5.

・Mac OS ・Python 3.7.3 ・pyqt5

How can I solve the error ?

bobhaffner commented 5 years ago

@Stern-Hayat Here are my versions if that helps

python 3.4.5
pyqt5 5.4.1

Abubakar26 commented 3 years ago

I am also facing the same issue my python version: 3.9.4 PyQt: 5.9.2 I tried to run it in both conda ENV and without condaenv but nothing happens Also, I faced a strange issue it is giving the img not valid error on the jpg format images but loading the PNG and JPEG format images can anyone help me in this matter

pd2871 commented 3 years ago

Installing PyQT5 solved the problem for me

pandyah5 commented 3 years ago

pip install --upgrade pyqt5 lxml --user

This solved the issue for me!

If that does not solve it too, then run the above command and then run this:

cd /d {LABELIMG_PATH} && pyrcc5 -o libs/resources.py resources.qrc

Use the path as per your pc.

phutaekwondo commented 3 years ago

change file's type to *png. I tried tried and solved in my case, because I had changed origin PNG file to JPG.

kuangxiaoye commented 2 years ago

conda install lxml

that ok