-
Notifications
You must be signed in to change notification settings - Fork 456
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FastDeploy RKNPU2 Memory Leak #1858
Comments
The below code will reproduce the issue import fastdeploy as fd
import time
import cv2
import os
def parse_arguments():
import argparse
import ast
parser = argparse.ArgumentParser()
parser.add_argument(
"--model_file", required=True, help="Path of rknn model.")
parser.add_argument(
"--image", type=str, required=True, help="Path of test image file.")
return parser.parse_args()
if __name__ == "__main__":
num = 300
x = 1
for _ in range(num):
args = parse_arguments()
model_file = args.model_file
params_file = ""
# 配置runtime,加载模型
runtime_option = fd.RuntimeOption()
runtime_option.use_rknpu2()
inferenceTimeMs: int = 0
start_time = time.perf_counter()
model = fd.vision.detection.RKYOLOV7(
model_file,
runtime_option=runtime_option,
model_format=fd.ModelFormat.RKNN)
# 预测图片分割结果
im = cv2.imread(args.image)
inferenceTimeMs = int((time.perf_counter() - start_time) * 1000)
result = model.predict(im)
print("InferenceTimeMs " + str(inferenceTimeMs) + "Count" + str(x))
x += 1
# 可视化结果
vis_im = fd.vision.vis_detection(im, result, score_threshold=0.5)
cv2.imwrite("visualized_result.jpg", vis_im)
print("Visualized result save in ./visualized_result.jpg") |
@Zheng-Bicheng Thanks |
@MikeLud |
@Zheng-Bicheng |
@MikeLud sudo -E python3 main.py |
I did not reproduce the error you made. I guess this problem may be caused by insufficient execution permissions of the application. |
When I execute with the below it can not find the fastdeploy module. Did you use the code in this link #1858 (comment)
|
From what I can tell the below is not executing as part of the backend to free up the memory. |
Environment
FastDeploy version: latest code in develop branch
OS Platform: Linux (Linux 5.10.110-rockchip-rk3588 #23.02.2 SMP Fri Feb 17 23:59:20 UTC 2023)
Hardware: e.g. Orange Pi 5 Rockchip RK3588S 8-core 64-bit processor
Program Language: e.g. Python 3.9
Problem description
After running about 225 inferences I get the below errors
The text was updated successfully, but these errors were encountered: