代码拉取完成,页面将自动刷新
import os.path
from torch.utils.data import DataLoader
from evaluation.eval import eval_one_result
import dataloaders.pascal as pascal
exp_root_dir = './'
method_names = []
method_names.append('run_0')
if __name__ == '__main__':
# Dataloader
dataset = pascal.VOCSegmentation(transform=None, retname=True)
dataloader = DataLoader(dataset, batch_size=1, shuffle=False, num_workers=0)
# Iterate through all the different methods
for method in method_names:
results_folder = os.path.join(exp_root_dir, method, 'Results')
filename = os.path.join(exp_root_dir, 'eval_results', method.replace('/', '-') + '.txt')
if not os.path.exists(os.path.join(exp_root_dir, 'eval_results')):
os.makedirs(os.path.join(exp_root_dir, 'eval_results'))
if os.path.isfile(filename):
with open(filename, 'r') as f:
val = float(f.read())
else:
print("Evaluating method: {}".format(method))
jaccards = eval_one_result(dataloader, results_folder, mask_thres=0.8)
val = jaccards["all_jaccards"].mean()
# Show mean and store result
print("Result for {:<80}: {}".format(method, str.format("{0:.1f}", 100*val)))
with open(filename, 'w') as f:
f.write(str(val))
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。