对于YOLOv3,首先要加一个img输入
input:"img_info"
input_shape{
dim:1
dim:4
}
因为YOLO有三个输出,所以在增加YoloV3DetectionOutput算子之前需要先增加三个Yolo算子,分别对应三个输出结果
layer {
bottom: "374"#对应输出的数值
top: "yolo1_coords"
top: "yolo1_obj"
top: "yolo1_classes"
name: "yolo1"
type: "Yolo"
yolo_param {
boxes: 3
coords: 4
classes: 9
yolo_version: "V3"
softmax: true
background: false
}
}
layer {
bottom: "360"
top: "yolo2_coords"
top: "yolo2_obj"
top: "yolo2_classes"
name: "yolo2"
type: "Yolo"
yolo_param {
boxes: 3
coords: 4
classes: 9
yolo_version: "V3"
softmax: true
background: false
}
}
layer {
bottom: "output"
top: "yolo3_coords"
top: "yolo3_obj"
top: "yolo3_classes"
name: "yolo3"
type: "Yolo"
yolo_param {
boxes: 3
coords: 4
classes: 9
yolo_version: "V3"
softmax: true
background: false
}
}
YoloV3DetectionOutput算子有十个输入,两个输出;根据该原则,构造的后处理算子代码样例如下:
layer {
name: "detection_out3"
type: "YoloV3DetectionOutput"
bottom: "yolo1_coords" #对应刚刚写好的三个算子
bottom: "yolo2_coords"
bottom: "yolo3_coords"
bottom: "yolo1_obj"
bottom: "yolo2_obj"
bottom: "yolo3_obj"
bottom: "yolo1_classes"
bottom: "yolo2_classes"
bottom: "yolo3_classes"
bottom: "img_info"
top: "box_out"
top: "box_out_num"
yolov3_detection_output_param {
boxes: 3
classes: 9
relative: true
obj_threshold: 0.5
score_threshold: 0.5
iou_threshold: 0.45
pre_nms_topn: 512
post_nms_topn: 1024
biases_high: 18
biases_high: 52
biases_high: 50
biases_high: 50
biases_high: 87
biases_high: 103
biases_mid: 10
biases_mid: 29
biases_mid: 22
biases_mid: 18
biases_mid: 31
biases_mid: 30
biases_low: 9
biases_low: 12
biases_low: 7
biases_low: 18
biases_low: 14
biases_low: 14
}
}