fix: python API that caused Memory leak

This commit is contained in:
AllenH 2020-09-15 15:47:05 +08:00
parent eb0272f27a
commit 5aa9fddce6
2 changed files with 2 additions and 0 deletions

View File

@ -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

View File

@ -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()