Unverified Commit 1affa2e8 authored by theonekeyg's avatar theonekeyg Committed by GitHub
Browse files

Change range(len) to enumerate (#2153)

parent 96268814
...@@ -122,7 +122,7 @@ class DatasetFolder(VisionDataset): ...@@ -122,7 +122,7 @@ class DatasetFolder(VisionDataset):
""" """
classes = [d.name for d in os.scandir(dir) if d.is_dir()] classes = [d.name for d in os.scandir(dir) if d.is_dir()]
classes.sort() classes.sort()
class_to_idx = {classes[i]: i for i in range(len(classes))} class_to_idx = {cls_name: i for i, cls_name in enumerate(classes)}
return classes, class_to_idx return classes, class_to_idx
def __getitem__(self, index): def __getitem__(self, index):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment