From 100edcf693b081e6d36bade42863bf28659318f4 Mon Sep 17 00:00:00 2001 From: WEN Hao Date: Thu, 2 Jul 2020 12:20:22 +0800 Subject: [PATCH] add the lost 'get_image_id' function --- dataset.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dataset.py b/dataset.py index ca0422d3..6f2ca1ce 100644 --- a/dataset.py +++ b/dataset.py @@ -407,6 +407,15 @@ def _get_val_item(self, index): return img, target +def get_image_id(filename:str) -> int: + """Convert a string to a integer.""" + raise NotImplementedError("Create your own 'get_image_id' function") + lv, no = os.path.splitext(os.path.basename(filename))[0].split("_") + lv = lv.replace("level", "") + no = f"{int(no):04d}" + return int(lv+no) + + if __name__ == "__main__": from cfg import Cfg