diff --git a/labelme/app.py b/labelme/app.py index 5b5c6e94d..3ca529f32 100644 --- a/labelme/app.py +++ b/labelme/app.py @@ -8,6 +8,7 @@ import webbrowser import imgviz +import natsort from qtpy import QtCore from qtpy.QtCore import Qt from qtpy import QtGui @@ -2075,5 +2076,5 @@ def scanAllImages(self, folderPath): if file.lower().endswith(tuple(extensions)): relativePath = osp.join(root, file) images.append(relativePath) - images.sort(key=lambda x: x.lower()) + images = natsort.os_sorted(images) return images diff --git a/setup.py b/setup.py index ecacbb3a4..21bf73d81 100644 --- a/setup.py +++ b/setup.py @@ -31,6 +31,7 @@ def get_install_requires(): install_requires = [ "imgviz>=0.11", "matplotlib<3.3", # for PyInstaller + "natsort>=7.1.0", "numpy", "Pillow>=2.8", "PyYAML",