mirror of https://github.com/AlexeyAB/darknet.git
fix: python API that caused Memory leak
This commit is contained in:
parent
eb0272f27a
commit
5aa9fddce6
|
@ -111,6 +111,7 @@ def image_detection(image_path, network, class_names, class_colors, thresh):
|
|||
|
||||
darknet.copy_image_from_bytes(darknet_image, image_resized.tobytes())
|
||||
detections = darknet.detect_image(network, class_names, darknet_image, thresh=thresh)
|
||||
darknet.free_image(darknet_image)
|
||||
image = darknet.draw_boxes(detections, image_resized, class_colors)
|
||||
return cv2.cvtColor(image, cv2.COLOR_BGR2RGB), detections
|
||||
|
||||
|
|
|
@ -84,6 +84,7 @@ def inference(darknet_image_queue, detections_queue, fps_queue):
|
|||
fps_queue.put(fps)
|
||||
print("FPS: {}".format(fps))
|
||||
darknet.print_detections(detections, args.ext_output)
|
||||
darknet.free_image(darknet_image)
|
||||
cap.release()
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue