Memory leak
kopyl opened this issue · comments
Here is some logs from memory profiler:
Line # Mem usage Increment Occurrences Line Contents
=============================================================
71 181.3867 MiB 181.3867 MiB 1 @profile(precision=4)
72 def predict_single_image(img_url):
73 459.8711 MiB 278.4844 MiB 1 img = get_image_from_url(img_url)
74 # if "error" in img:
75 # return img
76 460.6953 MiB 0.8242 MiB 1 img = img["image"]
77
78 # img = resize_with_pad(img, (800, 800))
79 8690.9766 MiB 8230.2812 MiB 1 boxes, scores, class_ids = yolov8_detector(img)
80 8690.9766 MiB 0.0000 MiB 1 return []
81 prediction = map(
82 lambda x:
83 {
84 "label": class_names[x[0]],
85 "score": float(x[1]),
86 "box": [float(x) for x in x[2]]
87 },
88 zip(class_ids, scores, boxes)
89 )
90 del boxes, scores, class_ids
91 # return list(prediction)
92 return []
- 8 gigs per single operation. And after the execution everything stays in memory for some reason. Do you know why and how to remove it from memory?
Probably not a memory leak on your side... Sorry