提交 983867f7 编写于 作者: J Jethong

fix dataset

上级 1fe8e2c7
...@@ -72,6 +72,7 @@ class PGDataSet(Dataset): ...@@ -72,6 +72,7 @@ class PGDataSet(Dataset):
def __getitem__(self, idx): def __getitem__(self, idx):
file_idx = self.data_idx_order_list[idx] file_idx = self.data_idx_order_list[idx]
data_line = self.data_lines[file_idx] data_line = self.data_lines[file_idx]
img_id = 0
try: try:
data_line = data_line.decode('utf-8') data_line = data_line.decode('utf-8')
substr = data_line.strip("\n").split(self.delimiter) substr = data_line.strip("\n").split(self.delimiter)
...@@ -79,8 +80,9 @@ class PGDataSet(Dataset): ...@@ -79,8 +80,9 @@ class PGDataSet(Dataset):
label = substr[1] label = substr[1]
img_path = os.path.join(self.data_dir, file_name) img_path = os.path.join(self.data_dir, file_name)
if self.mode.lower() == 'eval': if self.mode.lower() == 'eval':
try:
img_id = int(data_line.split(".")[0][7:]) img_id = int(data_line.split(".")[0][7:])
else: except:
img_id = 0 img_id = 0
data = {'img_path': img_path, 'label': label, 'img_id': img_id} data = {'img_path': img_path, 'label': label, 'img_id': img_id}
if not os.path.exists(img_path): if not os.path.exists(img_path):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册