提交 e4cf4ee7 编写于 作者: C chenguowei01

update val.py

上级 2a8b6435
...@@ -95,8 +95,8 @@ def evaluate(model, ...@@ -95,8 +95,8 @@ def evaluate(model,
for step, (im, im_info, label) in enumerate(eval_dataset): for step, (im, im_info, label) in enumerate(eval_dataset):
im = to_variable(im) im = to_variable(im)
pred, _ = model(im, mode='eval') pred, _ = model(im, mode='eval')
pred = pred.numpy() pred = pred.numpy().astype('float32')
pred = np.squeeze(pred).astype('uint8') pred = np.squeeze(pred)
for info in im_info[::-1]: for info in im_info[::-1]:
if info[0] == 'resize': if info[0] == 'resize':
h, w = info[1][0], info[1][1] h, w = info[1][0], info[1][1]
...@@ -108,6 +108,7 @@ def evaluate(model, ...@@ -108,6 +108,7 @@ def evaluate(model,
raise Exception("Unexpected info '{}' in im_info".format( raise Exception("Unexpected info '{}' in im_info".format(
info[0])) info[0]))
pred = pred[np.newaxis, :, :, np.newaxis] pred = pred[np.newaxis, :, :, np.newaxis]
pred = pred.astype('int64')
mask = label != ignore_index mask = label != ignore_index
conf_mat.calculate(pred=pred, label=label, ignore=mask) conf_mat.calculate(pred=pred, label=label, ignore=mask)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册