我从while循环调用这个函数'detection_bbox'
def search_layer(detection):
center_x, center_y, w, h = (detection[0:4] * np.array([width, height, width, height])).astype('int')
x = int(center_x - w / 2)
y = int(center_y - h / 2)
return [x, y, int(w), int(h)]
def detection_bbox(layer_outputs):
b_boxes = []
for l_output in layer_outputs:
b_boxes.extend([search_layer(detect) for detect in l_output if detect[5] > 0.5])
return b_boxes
我试着在1.2GHz的CPU上运行它。l_输出大约有5000个元素,因此它大大降低了我的应用程序的速度。我怎样才能加快速度
search_layer
必须是您的瓶颈,因为其他一切都应该非常快,所以:search_layer
detect[5]>0
的元素调用search_layer
-减少搜索空间并search_layer
一次李>相关问题 更多 >
编程相关推荐