未验证 提交 d6ead3e2 编写于 作者: J Jason 提交者: GitHub

Merge pull request #277 from FlyingQianMM/develop_qh

fix miou is 0 when im_info is []
...@@ -420,9 +420,6 @@ class DeepLabv3p(BaseAPI): ...@@ -420,9 +420,6 @@ class DeepLabv3p(BaseAPI):
elif info[0] == 'padding': elif info[0] == 'padding':
w, h = info[1][1], info[1][0] w, h = info[1][1], info[1][0]
one_pred = one_pred[0:h, 0:w] one_pred = one_pred[0:h, 0:w]
else:
raise Exception(
"Unexpected info '{}' in im_info".format(info[0]))
one_pred = one_pred.astype('int64') one_pred = one_pred.astype('int64')
one_pred = one_pred[np.newaxis, :, :, np.newaxis] one_pred = one_pred[np.newaxis, :, :, np.newaxis]
one_label = one_label[np.newaxis, np.newaxis, :, :] one_label = one_label[np.newaxis, np.newaxis, :, :]
...@@ -480,9 +477,6 @@ class DeepLabv3p(BaseAPI): ...@@ -480,9 +477,6 @@ class DeepLabv3p(BaseAPI):
w, h = info[1][1], info[1][0] w, h = info[1][1], info[1][0]
pred = pred[0:h, 0:w] pred = pred[0:h, 0:w]
logit = logit[0:h, 0:w, :] logit = logit[0:h, 0:w, :]
else:
raise Exception("Unexpected info '{}' in im_info".format(
info[0]))
pred_list.append(pred) pred_list.append(pred)
logit_list.append(logit) logit_list.append(logit)
......
...@@ -73,8 +73,6 @@ class Compose(SegTransform): ...@@ -73,8 +73,6 @@ class Compose(SegTransform):
tuple: 根据网络所需字段所组成的tuple;字段由transforms中的最后一个数据预处理操作决定。 tuple: 根据网络所需字段所组成的tuple;字段由transforms中的最后一个数据预处理操作决定。
""" """
if im_info is None:
im_info = list()
if isinstance(im, np.ndarray): if isinstance(im, np.ndarray):
if len(im.shape) != 3: if len(im.shape) != 3:
raise Exception( raise Exception(
...@@ -86,6 +84,8 @@ class Compose(SegTransform): ...@@ -86,6 +84,8 @@ class Compose(SegTransform):
except: except:
raise ValueError('Can\'t read The image file {}!'.format(im)) raise ValueError('Can\'t read The image file {}!'.format(im))
im = im.astype('float32') im = im.astype('float32')
if im_info is None:
im_info = [('origin_shape', im.shape[0:2])]
if self.to_rgb: if self.to_rgb:
im = cv2.cvtColor(im, cv2.COLOR_BGR2RGB) im = cv2.cvtColor(im, cv2.COLOR_BGR2RGB)
if label is not None: if label is not None:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册