基本上都是在test检测文件中
SSD-tensorflow中的修改
ymin = int(bboxes[i, 0] * height)
xmin = int(bboxes[i, 1] * width)
ymax = int(bboxes[i, 2] * height)
xmax = int(bboxes[i, 3] * width)
# xmi.append(xmin)
# ymi.append(ymin)
# xma.append(xmax)
# yma.append(ymax)
if cls_id == 1:
with open('/home/lab515/tt/code_jmy/SSD-Tensorflow/map/map/detections_txt/%s.txt' % name, 'a') as file:
file.writelines("columnar"+" "+str('{:.3f}'.format(score))+" "+ str(xmin)+" "+str(ymin)+" "+str(xmax)+" "+str(ymax))
file.write('\n')
yolov3-keras中的修改
top = max(0, np.floor(top + 0.5).astype('int32'))
left = max(0, np.floor(left + 0.5).astype('int32'))
bottom = min(image.size[1], np.floor(bottom + 0.5).astype('int32'))
right = min(image.size[0], np.floor(right + 0.5).astype('int32'))
if predicted_class == 'no':
no = [left, top, right, bottom]
label_a = '整体判断1,检测到正常行为 ' + str(score)
####jmy####
with open('./map/detections_txt/%s.txt' % name, 'a') as file:
file.writelines(
"no" + " " + str('{:.3f}'.format(score)) + " " + str(left) + " " + str(top) + " " + str(right) + " " + str(bottom))
file.write('\n')
####jmy####