提交 f6ee5c88 编辑于 作者: suilin0432's avatar suilin0432
浏览文件

add

上级 8a0826db
......@@ -91,21 +91,21 @@ def load_voc_instances_wsl(dirname: str, split: str, class_names: Union[List[str
fileids = np.loadtxt(f, dtype=np.str)
# 针对 single-input 的文件
# print("load from {}/single_voc07_wsl_{}_contain.json".format(dirname, split))
# annotation_wsl = json.load(open(
# "{}/single_voc07_wsl_{}_contain.json".format(dirname, split), "r"
# ))
# 获取 annotations, wsl 预测之后的结果会保存为 json 的格式
if "07" in dirname:
annotation_wsl = json.load(open(
"{}/voc07_wsl_{}_contain.json".format(dirname, split), "r"
))
elif "12" in dirname:
print("load from {}/single_voc07_wsl_{}_contain.json".format(dirname, split))
annotation_wsl = json.load(open(
"{}/casd_voc12_wsl_{}_contain.json".format(dirname, split), "r"
"{}/single_voc07_wsl_{}_contain.json".format(dirname, split), "r"
))
else:
assert False, "Wrong dirname: {}".format(dirname)
# 获取 annotations, wsl 预测之后的结果会保存为 json 的格式
# if "07" in dirname:
# annotation_wsl = json.load(open(
# "{}/voc07_wsl_{}_contain.json".format(dirname, split), "r"
# ))
# elif "12" in dirname:
# annotation_wsl = json.load(open(
# "{}/casd_voc12_wsl_{}_contain.json".format(dirname, split), "r"
# ))
# else:
# assert False, "Wrong dirname: {}".format(dirname)
multi_class_labels = None
if "multi_label" in annotation_wsl:
multi_class_labels = annotation_wsl.pop("multi_label")
......
......@@ -118,7 +118,7 @@ class PascalVOCDetectionEvaluator(DatasetEvaluator):
)
)
result_save_path_template = "/home/suil/codes/voc12result/comp4_det_test_{}.txt"
result_save_path_template = "/home/suil/codes/voc12result_ssod/VOC2012/Main/comp4_det_test_{}.txt"
with tempfile.TemporaryDirectory(prefix="pascal_voc_eval_") as dirname:
res_file_template = os.path.join(dirname, "{}.txt")
......@@ -127,10 +127,10 @@ class PascalVOCDetectionEvaluator(DatasetEvaluator):
for cls_id, cls_name in enumerate(self._class_names):
lines = predictions.get(cls_id, [""])
if os.path.isdir("/home/suil/codes/voc12result/") and "voc_2012_test" in self._dataset_name:
if os.path.isdir("/home/suil/codes/voc12result_ssod/") and "voc_2012_test" in self._dataset_name:
print("saving result to {}".format(result_save_path_template.format(cls_name)))
result_save_file = open(result_save_path_template.format(cls_name), "w")
result_save_file.write("\n".join(lines))
result_save_file.write("\n".join(lines)+"\n")
if "voc_2012_test" in self._dataset_name:
continue
......
支持 Markdown
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册