animelover commited on
Commit
8482239
·
1 Parent(s): 67ce876

Update danbooru2022.py

Browse files
Files changed (1) hide show
  1. danbooru2022.py +1 -2
danbooru2022.py CHANGED
@@ -42,8 +42,7 @@ class DanbooruDataset(datasets.GeneratorBasedBuilder):
42
  for path in filepath:
43
  all_fnames = {os.path.relpath(os.path.join(root, fname), start=path)
44
  for root, _dirs, files in os.walk(path) for fname in files}
45
- image_fnames = sorted(fname for fname in all_fnames
46
- if os.path.splitext(fname)[1].lower() in _EXTENSION)
47
  for image_fname in image_fnames:
48
  image_path = os.path.join(path, image_fname)
49
  tags_path = os.path.join(path, os.path.splitext(image_fname)[0] + ".txt")
 
42
  for path in filepath:
43
  all_fnames = {os.path.relpath(os.path.join(root, fname), start=path)
44
  for root, _dirs, files in os.walk(path) for fname in files}
45
+ image_fnames = sorted([fname for fname in all_fnames if os.path.splitext(fname)[1].lower() in _EXTENSION], reverse=True)
 
46
  for image_fname in image_fnames:
47
  image_path = os.path.join(path, image_fname)
48
  tags_path = os.path.join(path, os.path.splitext(image_fname)[0] + ".txt")