持续识别的时候,内存一直在增长
bzitlab opened this issue · 3 comments
using OpenCvSharp;
using Sdcb.OpenVINO.PaddleOCR.Models.Online;
using Sdcb.OpenVINO.PaddleOCR.Models;
using Sdcb.OpenVINO.PaddleOCR;
using System.Diagnostics;
using System;
FullOcrModel model = await OnlineFullModels.ChineseV4.DownloadAsync();
//using Mat src = Cv2.ImDecode(await new HttpClient().GetByteArrayAsync("https://io.starworks.cc:88/paddlesharp/ocr/samples/xdr5450.webp"), ImreadModes.Color);
var fileNames = Directory.GetFiles(@"E:\simpletest").ToList();
using (PaddleOcrAll all = new(model)
{
AllowRotateDetection = true,
Enable180Classification = true,
})
{
fileNames.ForEach(srcfile =>
{
// Load local file by following code:
using (Mat src = Cv2.ImRead(srcfile))
{
Stopwatch sw = Stopwatch.StartNew();
PaddleOcrResult result = all.Run(src);
Console.WriteLine($"elapsed={sw.ElapsedMilliseconds} ms");
Console.WriteLine("Detected all texts: \n" + result.Text);
foreach (PaddleOcrResultRegion region in result.Regions)
{
Console.WriteLine($"Text: {region.Text}, Score: {region.Score}, RectCenter: {region.Rect.Center}, RectSize: {region.Rect.Size}, Angle: {region.Rect.Angle}");
}
}
});
}
看到你升级到了0.3.1版本,它还是有相同的问题吗——也就是1300张照片,内存持续缓慢增长,最终增长到5GB?
不知道是否和上游的openvino issue有关:https://github.com/openvinotoolkit/openvino/issues?q=is%3Aissue+memory+leak+is%3Aclosed ,请持续关注