Skip to content

Commit 49b8426

Browse files
authored
Merge pull request #251 from yuxx0218/master
create usable get_image_id function
2 parents 4ccef0e + 734d65d commit 49b8426

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

dataset.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -423,11 +423,18 @@ def get_image_id(filename:str) -> int:
423423
>>> no = f"{int(no):04d}"
424424
>>> return int(lv+no)
425425
"""
426-
raise NotImplementedError("Create your own 'get_image_id' function")
427-
lv, no = os.path.splitext(os.path.basename(filename))[0].split("_")
428-
lv = lv.replace("level", "")
429-
no = f"{int(no):04d}"
430-
return int(lv+no)
426+
# raise NotImplementedError("Create your own 'get_image_id' function")
427+
# lv, no = os.path.splitext(os.path.basename(filename))[0].split("_")
428+
# lv = lv.replace("level", "")
429+
# no = f"{int(no):04d}"
430+
# return int(lv+no)
431+
432+
print("You could also create your own 'get_image_id' function.")
433+
# print(filename)
434+
parts = filename.split('/')
435+
id = int(parts[-1][0:-4])
436+
# print(id)
437+
return id
431438

432439

433440
if __name__ == "__main__":

0 commit comments

Comments
 (0)