-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[bug] Open json file & json folder, file list panel is empty #1009
Comments
What happens when you do the following?
|
Cloning to local, Get the following error:
|
I'm not sure why this happens, but it looks like pyqt is not installed properly. Maybe you need to run |
(labelme) E:\Github\labelme>pip install pyqt5
Requirement already satisfied: pyqt5 in c:\programdata\miniconda3\envs\labelme\lib\site-packages\pyqt5-5.15.7-py3.9-win-amd64.egg (5.15.7)
Requirement already satisfied: PyQt5-sip<13,>=12.11 in c:\programdata\miniconda3\envs\labelme\lib\site-packages\pyqt5_sip-12.11.0-py3.9-win-amd64.egg (from pyqt5) (12.11.0)
Requirement already satisfied: PyQt5-Qt5>=5.15.0 in c:\programdata\miniconda3\envs\labelme\lib\site-packages\pyqt5_qt5-5.15.2-py3.9-win-amd64.egg (from pyqt5) (5.15.2) Here is my environment:
I think similar with this issue: |
Have you tried this? What does conda list says? |
Please skip this and check the next comment create new conda env [failed]E:\Github\labelme> conda create -n lbtest python=3 qt pyqt pyside2 -y
Collecting package metadata (current_repodata.json): done
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed
PackagesNotFoundError: The following packages are not available from current channels:
- pyside2 install qt by conda [failed]And also tried to install qt via conda (I prefer using conda as virtual env manager and using pip install only, rather than using any conda install): (labelme) E:\Github\labelme>conda install qt
Collecting package metadata (current_repodata.json): done
Solving environment: done
==> WARNING: A newer version of conda exists. <==
current version: 4.10.3
latest version: 4.13.0
Please update conda by running
$ conda update -n base -c defaults conda
## Package Plan ##
environment location: C:\ProgramData\Miniconda3\envs\labelme
added / updated specs:
- qt
The following packages will be downloaded:
package | build
---------------------------|-----------------
icu-58.2 | ha925a31_3 9.4 MB
jpeg-9e | h2bbff1b_0 292 KB
qt-5.9.7 | vc14h73c81de_0 72.5 MB
zlib-1.2.12 | h8cc25b3_2 116 KB
------------------------------------------------------------
Total: 82.3 MB
The following NEW packages will be INSTALLED:
icu pkgs/main/win-64::icu-58.2-ha925a31_3
jpeg pkgs/main/win-64::jpeg-9e-h2bbff1b_0
libpng pkgs/main/win-64::libpng-1.6.37-h2a8f88b_0
qt pkgs/main/win-64::qt-5.9.7-vc14h73c81de_0
zlib pkgs/main/win-64::zlib-1.2.12-h8cc25b3_2
Proceed ([y]/n)? y
Downloading and Extracting Packages
qt-5.9.7 | 72.5 MB | ############################# | 100%
icu-58.2 | 9.4 MB | ############################# | 100%
zlib-1.2.12 | 116 KB | ############################# | 100%
jpeg-9e | 292 KB | ############################# | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
(labelme) E:\Github\labelme>labelme
Traceback (most recent call last):
File "C:\ProgramData\Miniconda3\envs\labelme\Scripts\labelme-script.py", line 33, in <module>
sys.exit(load_entry_point('labelme==5.0.1', 'console_scripts', 'labelme')())
File "C:\ProgramData\Miniconda3\envs\labelme\Scripts\labelme-script.py", line 25, in importlib_load_entry_point
return next(matches).load()
File "C:\ProgramData\Miniconda3\envs\labelme\lib\importlib\metadata.py", line 86, in load
module = import_module(match.group('module'))
File "C:\ProgramData\Miniconda3\envs\labelme\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "C:\ProgramData\Miniconda3\envs\labelme\lib\site-packages\labelme-5.0.1-py3.9.egg\labelme\__init__.py", line 17, in <module>
QT4 = QT_VERSION[0] == "4"
TypeError: 'NoneType' object is not subscriptable Please skip this, and check the next comment seems pyqt5 problem [solution not found](labelme) E:\Github\labelme>python
Python 3.9.12 (main, Apr 4 2022, 05:22:27) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import PyQt5
>>> from PyQt5.QtCore import *
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: DLL load failed while importing QtCore: The specified procedure could not be found. Following this website, copy python3.dll and python39.dll to virtual env scripts folder seems still not work Follwoing this website, using admin cmd to run (labelme) C:\Users\CREST>python -m pip install --upgrade pyqt5==5.9
ERROR: Could not find a version that satisfies the requirement pyqt5==5.9 (from versions: 5.12.3, 5.14.0, 5.14.1, 5.14.2, 5.15.0, 5.15.1, 5.15.2, 5.15.3, 5.15.4, 5.15.5, 5.15.6, 5.15.7)
ERROR: No matching distribution found for pyqt5==5.9 |
Succeed by the following: (labelme) C:\Users\CREST>conda create -c conda-forge -n lbtest python=3 qt pyqt pyside2
(labelme) C:\Users\CREST>conda activate lbtest
# cd to path
(lbtest) E:\Github\labelme>python setup.py build
running build
running build_py
(lbtest) E:\Github\labelme>python setup.py install
...
UPDATING build\lib.win-amd64-cpython-310\matplotlib\_version.py
set build\lib.win-amd64-cpython-310\matplotlib\_version.py to '3.2.2'
checkdep_freetype2.c
src/checkdep_freetype2.c(5): fatal error C1189: #error: "FreeType version 2.3 or higher is required. You may set the MPLLOCALFREETYPE environment variable to 1 to let Matplotlib download it."
error: Setup script exited with error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2 check is the matplotlib install error by default (lbtest) E:\Github\labelme>conda install matplotlib
...
(lbtest) E:\Github\labelme>python setup.py build
running build
running build_py
(lbtest) E:\Github\labelme>python setup.py install
... # some crazy logs
Using c:\programdata\miniconda3\envs\lbtest\lib\site-packages
Finished processing dependencies for labelme==5.0.1 Then the labelme seems correctly installed. (lbtest) E:\Github\labelme>labelme -h
usage: labelme [-h] [--version] [--reset-config] [--logger-level {debug,info,warning,fatal,error}] [--output OUTPUT] [--config CONFIG] [--nodata] [--autosave] [--nosortlabels] [--flags FLAGS] [--labelflags LABEL_FLAGS]
[--labels LABELS] [--validatelabel {exact}] [--keep-prev] [--epsilon EPSILON]
[filename]
positional arguments:
filename image or label filename
options:
-h, --help show this help message and exit
--version, -V show version
--reset-config reset qt config
--logger-level {debug,info,warning,fatal,error}
logger level
--output OUTPUT, -O OUTPUT, -o OUTPUT
output file or directory (if it ends with .json it is recognized as file, else as directory)
--config CONFIG config file or yaml-format string (default: C:\Users\CREST\.labelmerc)
--nodata stop storing image data to JSON file
--autosave auto save
--nosortlabels stop sorting labels
--flags FLAGS comma separated list of flags OR file containing flags
--labelflags LABEL_FLAGS
yaml string of label specific flags OR file containing json string of label specific flags (ex. {person-\d+: [male, tall], dog-\d+: [black, brown, white], .*: [occluded]})
--labels LABELS comma separated list of labels OR file containing labels
--validatelabel {exact}
label validation types
--keep-prev keep annotation of previous frame
--epsilon EPSILON epsilon to find nearest vertex on canvas And run your tests, seems the GUI can not succesfully launch (lbtest) E:\Github\labelme>labelme examples/semantic_segmentation/data_annotated/
This JSON file (examples/semantic_segmentation/data_annotated/2011_000003.json) may be incompatible with current labelme. version in file: 4.0.0, current version: 5.0.1
Traceback (most recent call last):
File "C:\ProgramData\Miniconda3\envs\lbtest\lib\site-packages\labelme-5.0.1-py3.10.egg\labelme\app.py", line 1111, in fileSelectionChanged
self.loadFile(filename)
File "C:\ProgramData\Miniconda3\envs\lbtest\lib\site-packages\labelme-5.0.1-py3.10.egg\labelme\app.py", line 1538, in loadFile
self.loadLabels(self.labelFile.shapes)
File "C:\ProgramData\Miniconda3\envs\lbtest\lib\site-packages\labelme-5.0.1-py3.10.egg\labelme\app.py", line 1227, in loadLabels
self.loadShapes(s)
File "C:\ProgramData\Miniconda3\envs\lbtest\lib\site-packages\labelme-5.0.1-py3.10.egg\labelme\app.py", line 1188, in loadShapes
self.addLabel(shape)
File "C:\ProgramData\Miniconda3\envs\lbtest\lib\site-packages\labelme-5.0.1-py3.10.egg\labelme\app.py", line 1138, in addLabel
self.labelList.addItem(label_list_item)
File "C:\ProgramData\Miniconda3\envs\lbtest\lib\site-packages\labelme-5.0.1-py3.10.egg\labelme\widgets\label_list_widget.py", line 167, in addItem
item.setSizeHint(self.itemDelegate().sizeHint(None, None))
File "C:\ProgramData\Miniconda3\envs\lbtest\lib\site-packages\labelme-5.0.1-py3.10.egg\labelme\widgets\label_list_widget.py", line 64, in sizeHint
return QtCore.QSize(
TypeError: arguments did not match any overloaded call:
QSize(): too many arguments
QSize(int, int): argument 1 has unexpected type 'float'
QSize(QSize): argument 1 has unexpected type 'float' |
The last error seems caused by Python 3.10. |
Successfully on Python 3.7 The file list works for your examples (which json and img put together). However, for our applications, which json and image at different folders, the problem still exists. Then I checked the code in the app.py#L2037. This is caused by using the existed image name as list rather than json name as list. Hoping it can add another logic in self.scanAllImages:
PS: Another UI issue -> #1142, it seems the line space in the "label list" panel is not correct in the high-resolution display. (May forgot to update its code? The "polygon labels" and "file list" seems to have correct line space) |
Can you try —output option to specify the JSON directory?
Can you open an issue for the panel issue?
|
It does not work (because scanAllImages() filters image filename to processing list first, folders with only json labels will return an empty processing list). I have fixed that by myself by editing only However, when trying to pass all the tests before pull request, it seems in When I clone to local, I could not access them, so some open image tests can not pass. Since I only modified both functions, personally think it is okay to pull request? |
You also need to specify the directory of images. something like below:
|
Thank you for sharing this point, this works but not so convenient. I have modified the source code, now it can open the folder with only json directly (it will read the json file to get the directory of images), please check whether it is proper to merge into your main branch. Thanks again for your patient reply! |
By design, this cannot be achieved by |
Thank you to the developers for their efforts. Has this function been implemented? Very necessary! |
Thank you very much. I really, really need this feature you developed. I hope you can share the modified and optimized code with me. Thank you very much. |
Kindly find it here: #1143, that pull request was rejected But it was an old version (2 years ago?) if you use that directly. |
Labelem version: 5.0.0
When open dir with the following structure (with only json files):
The file list panel keeps empty
When open specific json name, the image appears but the file list panel still empty:
Expected:
The file panel appear with json image name, the left status box checked (means has been labelled)
The text was updated successfully, but these errors were encountered: