Skip to content

异步识别异常 #101

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

Open
yuyaolongwyyx opened this issue Jun 26, 2024 · 2 comments
Open

异步识别异常 #101

yuyaolongwyyx opened this issue Jun 26, 2024 · 2 comments

Comments

@yuyaolongwyyx
Copy link

Describe the bug

PaddleOCRAll.Run()对一批图片进行异步提取会报外部组件异常,它并不是一开始就报错的,可能是处理前面几张图片后开始报错,但是如果同步一张一张处理就不会报错,如何解决这个问题?

Steps to reproduce the bug

.

Expected behavior

No response

Screenshots

No response

Release version

No response

IDE

No response

OS version

No response

Additional context

No response

@sdcb
Copy link
Owner

sdcb commented Jun 26, 2024

你好,如果换成传统的单实例的QueuedPadddleOcrAll,会不会报错呢?

@shark-mk
Copy link

shark-mk commented Jul 5, 2024

我也曾遇到过没仔细去研究,如果需要配合复现此问题请联系我。
(不知我的用法是否正确,我在Parallel.ForEach中调用的Run)
当时的环境如下:
image

CUDA:
nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2021 NVIDIA Corporation
Built on Fri_Dec_17_18:28:54_Pacific_Standard_Time_2021
Cuda compilation tools, release 11.6, V11.6.55
Build cuda_11.6.r11.6/compiler.30794723_0

CUDNN:
cudnn-windows-x86_64-8.9.7.29_cuda11

错误堆栈如下:

CoreCLR Version: 8.0.624.26715
.NET Version: 8.0.6
Description: The process was terminated due to an unhandled exception.
Exception Info: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Stack:
at Sdcb.PaddleInference.Native.PaddleNative.PD_TensorCopyFromCpuFloat(IntPtr, IntPtr)
at Sdcb.PaddleInference.Native.PaddleNative.PD_TensorCopyFromCpuFloat(IntPtr, IntPtr)
at Sdcb.PaddleInference.PaddleTensor.SetData(Single[])
at Sdcb.PaddleOCR.PaddleOcrRecognizer.RunMulti(OpenCvSharp.Mat[])
at System.Linq.Enumerable+SelectManySingleSelectorIterator2[[System.ValueTuple2[[System.__Canon, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.ValueTuple2[[Sdcb.PaddleOCR.PaddleOcrRecognizerResult, Sdcb.PaddleOCR, Version=2.7.0.3, Culture=neutral, PublicKeyToken=null],[System.Int32, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].ToArray() at System.Linq.Enumerable+SelectIPartitionIterator2[[System.ValueTuple2[[Sdcb.PaddleOCR.PaddleOcrRecognizerResult, Sdcb.PaddleOCR, Version=2.7.0.3, Culture=neutral, PublicKeyToken=null],[System.Int32, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[Sdcb.PaddleOCR.PaddleOcrRecognizerResult, Sdcb.PaddleOCR, Version=2.7.0.3, Culture=neutral, PublicKeyToken=null]].LazyToArray() at System.Linq.Enumerable+SelectIPartitionIterator2[[System.ValueTuple2[[Sdcb.PaddleOCR.PaddleOcrRecognizerResult, Sdcb.PaddleOCR, Version=2.7.0.3, Culture=neutral, PublicKeyToken=null],[System.Int32, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[Sdcb.PaddleOCR.PaddleOcrRecognizerResult, Sdcb.PaddleOCR, Version=2.7.0.3, Culture=neutral, PublicKeyToken=null]].ToArray() at Sdcb.PaddleOCR.PaddleOcrRecognizer.Run(OpenCvSharp.Mat[], Int32) at Sdcb.PaddleOCR.PaddleOcrAll.Run(OpenCvSharp.Mat, Int32) at Program+<>c__DisplayClass0_1.<Main>b__0(System.String) at System.Threading.Tasks.Parallel+<>c__DisplayClass19_02[[System.__Canon, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Int32, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].b__1(System.Threading.Tasks.RangeWorker ByRef, Int64, Boolean ByRef)
at System.Threading.Tasks.TaskReplicator+Replica.Execute()
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(System.Threading.Tasks.Task ByRef, System.Threading.Thread)
at System.Threading.Tasks.ThreadPoolTaskScheduler.TryExecuteTaskInline(System.Threading.Tasks.Task, Boolean)
at System.Threading.Tasks.TaskScheduler.TryRunInline(System.Threading.Tasks.Task, Boolean)
at System.Threading.Tasks.Task.InternalRunSynchronously(System.Threading.Tasks.TaskScheduler, Boolean)
at System.Threading.Tasks.TaskReplicator.Run[[System.Threading.Tasks.RangeWorker, System.Threading.Tasks.Parallel, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]](ReplicatableUserAction1<System.Threading.Tasks.RangeWorker>, System.Threading.Tasks.ParallelOptions, Boolean) at System.Threading.Tasks.Parallel.ForWorker[[System.__Canon, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Int32, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](Int32, Int32, System.Threading.Tasks.ParallelOptions, System.Action1, System.Action2<Int32,System.Threading.Tasks.ParallelLoopState>, System.Func4<Int32,System.Threading.Tasks.ParallelLoopState,System.__Canon,System.__Canon>, System.Func1<System.__Canon>, System.Action1<System.__Canon>)
at System.Threading.Tasks.Parallel.ForEachWorker[[System.__Canon, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable1<System.__Canon>, System.Threading.Tasks.ParallelOptions, System.Action1<System.__Canon>, System.Action2<System.__Canon,System.Threading.Tasks.ParallelLoopState>, System.Action3<System.__Canon,System.Threading.Tasks.ParallelLoopState,Int64>, System.Func4<System.__Canon,System.Threading.Tasks.ParallelLoopState,System.__Canon,System.__Canon>, System.Func5<System.__Canon,System.Threading.Tasks.ParallelLoopState,Int64,System.__Canon,System.__Canon>, System.Func1<System.__Canon>, System.Action1<System.__Canon>)
at System.Threading.Tasks.Parallel.ForEach[[System.__Canon, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable1<System.__Canon>, System.Threading.Tasks.ParallelOptions, System.Action1<System.__Canon>)
at Program.Main(System.String[])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants