labelImg icon indicating copy to clipboard operation
labelImg copied to clipboard

labelImg.exe is unable to use the predefined_classes.txt

Open zhasen1996 opened this issue 3 years ago • 7 comments

  • **OS:**win10, python3.8
  • **PyQt version:**12.11.0

zhasen1996 avatar Nov 16 '22 04:11 zhasen1996

Python labelImg.py works well, but labelImg.exe can not find the predefined_classes.txt.

zhasen1996 avatar Nov 16 '22 04:11 zhasen1996

Error info: QMimeDatabase: Error loading internal MIME data An error has been encountered at line 1 of <internal MIME data>: Premature end of document.: Not find:/data/predefined_classes.txt (optional)

zhasen1996 avatar Nov 16 '22 04:11 zhasen1996

data/predefined_classes.txt and labelImg.exe are in the same directory.

zhasen1996 avatar Nov 16 '22 04:11 zhasen1996

you need to embed /data file in the .exe file code: pyinstaller --hidden-import=pyqt5 --hidden-import=lxml -F -n "labelImg1" -c labelImg.py -p ./libs -p ./ --add-data " Your PATH/data;data/"

spped2000 avatar Dec 20 '22 16:12 spped2000

you need to embed /data file in the .exe file code: pyinstaller --hidden-import=pyqt5 --hidden-import=lxml -F -n "labelImg1" -c labelImg.py -p ./libs -p ./ --add-data " Your PATH/data;data/"

Hello, I tried your solution in terminal but didn't work:

'pyinstall' is not recognized as an internal or external command, operable program or batch file.

Could you please help me to solve it ?

Evelyn0402 avatar Jan 16 '23 18:01 Evelyn0402

you need to embed /data file in the .exe file code: pyinstaller --hidden-import=pyqt5 --hidden-import=lxml -F -n "labelImg1" -c labelImg.py -p ./libs -p ./ --add-data " Your PATH/data;data/"

Hello, I tried your solution in terminal but didn't work:

'pyinstall' is not recognized as an internal or external command, operable program or batch file.

Could you please help me to solve it ?

You need to put this command " python -m PyInstaller " before in terminal

spped2000 avatar Jan 17 '23 07:01 spped2000

The above operation fixes the predefine_classes.txt. If you want to change the path or file, type it below and run it

labelimg.exe class_file ./data/predefined_classes.txt

acejsk avatar Apr 26 '23 07:04 acejsk