1 Star 0 Fork 0

pauleta/DEXTR-PyTorch

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
eval_all.py 1.28 KB
一键复制 编辑 原始数据 按行查看 历史
kmaninis 提交于 2018-03-14 20:45 . - download scripts
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))
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/pauleta/DEXTR-PyTorch.git
git@gitee.com:pauleta/DEXTR-PyTorch.git
pauleta
DEXTR-PyTorch
DEXTR-PyTorch
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385