Skip to content

Commit

Permalink
fix: python API that caused Memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaing committed Sep 15, 2020
1 parent eb0272f commit 5aa9fdd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions darknet_images.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions darknet_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()


Expand Down

1 comment on commit 5aa9fdd

@brandhsu
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this change to darknet_video.py seems to cause a segmentation fault

Please sign in to comment.