|
@@ -29,7 +29,7 @@ if __name__ == "__main__":
|
|
# 此处的classes_path用于指定需要测量VOC_map的类别
|
|
# 此处的classes_path用于指定需要测量VOC_map的类别
|
|
# 一般情况下与训练和预测所用的classes_path一致即可
|
|
# 一般情况下与训练和预测所用的classes_path一致即可
|
|
#--------------------------------------------------------------------------------------#
|
|
#--------------------------------------------------------------------------------------#
|
|
- classes_path = '/root/autodl-tmp/faster-rcnn-pytorch-master/model_data/voc_classes.txt'
|
|
|
|
|
|
+ classes_path = './/model_data/voc_classes.txt'
|
|
#--------------------------------------------------------------------------------------#
|
|
#--------------------------------------------------------------------------------------#
|
|
# MINOVERLAP用于指定想要获得的mAP0.x,mAP0.x的意义是什么请同学们百度一下。
|
|
# MINOVERLAP用于指定想要获得的mAP0.x,mAP0.x的意义是什么请同学们百度一下。
|
|
# 比如计算mAP0.75,可以设定MINOVERLAP = 0.75。
|
|
# 比如计算mAP0.75,可以设定MINOVERLAP = 0.75。
|
|
@@ -68,12 +68,12 @@ if __name__ == "__main__":
|
|
# 指向VOC数据集所在的文件夹
|
|
# 指向VOC数据集所在的文件夹
|
|
# 默认指向根目录下的VOC数据集
|
|
# 默认指向根目录下的VOC数据集
|
|
#-------------------------------------------------------#
|
|
#-------------------------------------------------------#
|
|
- VOCdevkit_path = '/root/autodl-tmp/faster-rcnn-pytorch-master/VOCdevkit/VOC2007'
|
|
|
|
|
|
+ VOCdevkit_path = './/VOCdevkit/VOC2007'
|
|
#-------------------------------------------------------#
|
|
#-------------------------------------------------------#
|
|
# 结果输出的文件夹,默认为map_out
|
|
# 结果输出的文件夹,默认为map_out
|
|
#-------------------------------------------------------#
|
|
#-------------------------------------------------------#
|
|
map_out_path = 'map_out'
|
|
map_out_path = 'map_out'
|
|
- path_temp = "/root/autodl-tmp/faster-rcnn-pytorch-master/VOCdevkit/VOC2007/ImageSets/Main/test.txt"
|
|
|
|
|
|
+ path_temp = ".//VOCdevkit/VOC2007/ImageSets/Main/test.txt"
|
|
image_ids = open(path_temp).read().strip().split()
|
|
image_ids = open(path_temp).read().strip().split()
|
|
|
|
|
|
if not os.path.exists(map_out_path):
|
|
if not os.path.exists(map_out_path):
|
|
@@ -94,7 +94,7 @@ if __name__ == "__main__":
|
|
|
|
|
|
print("Get predict result.")
|
|
print("Get predict result.")
|
|
for image_id in tqdm(image_ids):
|
|
for image_id in tqdm(image_ids):
|
|
- img_path = "/root/autodl-tmp/faster-rcnn-pytorch-master/VOCdevkit/VOC2007/JPEGImages/"
|
|
|
|
|
|
+ img_path = ".//VOCdevkit/VOC2007/JPEGImages/"
|
|
image_path = os.path.join(img_path + image_id+".jpg")
|
|
image_path = os.path.join(img_path + image_id+".jpg")
|
|
image = Image.open(image_path)
|
|
image = Image.open(image_path)
|
|
if map_vis:
|
|
if map_vis:
|
|
@@ -106,7 +106,7 @@ if __name__ == "__main__":
|
|
print("Get ground truth result.")
|
|
print("Get ground truth result.")
|
|
for image_id in tqdm(image_ids):
|
|
for image_id in tqdm(image_ids):
|
|
with open(os.path.join(map_out_path, "ground-truth/"+image_id+".txt"), "w") as new_f:
|
|
with open(os.path.join(map_out_path, "ground-truth/"+image_id+".txt"), "w") as new_f:
|
|
- root_path = "/root/autodl-tmp/faster-rcnn-pytorch-master/VOCdevkit/VOC2007/Annotations/"
|
|
|
|
|
|
+ root_path = ".//VOCdevkit/VOC2007/Annotations/"
|
|
root = ET.parse(os.path.join(root_path + image_id+".xml")).getroot()
|
|
root = ET.parse(os.path.join(root_path + image_id+".xml")).getroot()
|
|
for obj in root.findall('object'):
|
|
for obj in root.findall('object'):
|
|
difficult_flag = False
|
|
difficult_flag = False
|