Skip to content

Releases: sdcb/OpenVINO.NET

v0.5.2

01 Nov 06:42
Compare
Choose a tag to compare

中文

该版本放宽了核心库Sdcb.OpenVINO的最低版本要求,从.NET Framework 4.8放宽到了.NET Framework 4.6.1,但当前代码是这样写的:
https://github.com/sdcb/OpenVINO.NET/blob/cdbeab2b85055b5c6ac20658794a031a8b4fe8ea/src/Sdcb.OpenVINO/Natives/NativeMethods.cs#L21-L28
这导致在.NET Framework版本< 4.8时,会尝试链接到openvino_c而非dll\win-x64\openvino_c.dll,这会导致触发一个DllNotFoundException。

正常使用Sdcb.OpenVINO.PaddleOCR不需要手动安装Sdcb.OpenVINO,因为前者依赖了后者,会自动安装,如果您使用.NET Framework版本小于.NET 4.8,就可以手动安装一下Sdcb.OpenVINO 0.5.2版本,这样就能用了。

English

This version has relaxed the minimum version requirement of the core library, Sdcb.OpenVINO, from .NET Framework 4.8 to .NET Framework 4.6.1. However, the current code is written as follows:
https://github.com/sdcb/OpenVINO.NET/blob/cdbeab2b85055b5c6ac20658794a031a8b4fe8ea/src/Sdcb.OpenVINO/Natives/NativeMethods.cs#L21-L28
This results in an attempt to link to openvino_c instead of dll\win-x64\openvino_c.dll when the .NET Framework version is < 4.8, causing a DllNotFoundException.

Typically, there is no need to manually install Sdcb.OpenVINO to use Sdcb.OpenVINO.PaddleOCR as the former automatically installs due to its dependency on the latter. If you are using a .NET Framework version less than .NET 4.8, you can manually install Sdcb.OpenVINO version 0.5.2, which should then work excellently.

v0.5.1

31 Oct 03:41
a9d344a
Compare
Choose a tag to compare

中文

大家好,我发布了下面3个包的新版本:

  • Sdcb.OpenVINO 0.5.1(从0.4.5)
  • Sdcb.OpenVINO.Extensions.OpenCvSharp4 0.2.0(从0.1.0)
  • Sdcb.OpenVINO.PaddleOCR 0.5.1(从0.3.1)

各有如下改进或新功能:

Sdcb.OpenVINO 0.5.1(从0.4.5)

  • 给DeviceOptions加入了NumStreams, SchedulingCoreType, EnableHyperThreading三个属性,允许配置推理流数量(默认自动),在大小核CPU上指定大核或小核(默认全用),是否启用超线程(默认不启用)
  • 新加了(internal的)TensorBuffer类,解决了Tensor类引用的内存所有权不明确的问题,今后Tensor将明确拥有或共享内存的所有权,如果使用数组,则会创建一个数组的引用,如果使用Mat,则创建一个Mat的引用(根据实际情况,使用ROI引用或者克隆)
  • BaseModel的CreateInferRequest函数改为CreateCompiledModel,今后将鼓励CompiledModel共享(而非InferRequest共享)

Sdcb.OpenVINO.Extensions.OpenCvSharp4 0.2.0(从0.1.0)

  • 增加了FastClone,并将WeakRef改为Obsolete(过时)
  • 删除了内存不安全的AsByteSpan函数
  • 实现了MatTensorBuffer(表示对Mat拥有或共享所有权的类)

Sdcb.OpenVINO.PaddleOCR 0.5.1(从0.3.1)

  • 所有推理类实现线程安全(原理:将所有推理类从共享InferRequest改成共享CompiledModel)
  • 修复了在不启用旋转识别时导致推理结果不正确的问题(感谢@ddeef提出)
  • 将QueuedPaddleOcrAll类改为Obsolete(过时),建议全用PaddleOcrAll(因为线程安全)
  • 180度图像分类器现在除了返回是否需要旋转,还返回了信心值

0.5.1新版本OCR性能测试结果

(使用i9-9880h,ChineseV3模型,静态图,启用180度旋转识别,静态图,其它全默认,每个数字都是100次平均,单位毫秒)
159 164 155 163 161 163 159 162 170 167
内存约396MB~1033MB,CPU使用率约55%~69%

使用SemaphoreSlim(2并发)
166 166 174 182 185 184 175 165 183 166
内存约328MB~344MB,CPU使用率约56%~58%

使用SemaphoreSlim(4并发)
153 155 159 158 162 159 166 181 162 160
内存约346MB~366MB,CPU使用率约60%~62%

0.3.1测试结果:
2消费者,低延时模式,100张平均耗时(ms)
158 153 154 156 157 160 161 157 159 163
内存约737MB~783MB

0.5.1可以在保持线程安全的同时,以较低的内存实现相似的性能指标,同时不会有多消费者崩溃的问题。

English

Hello everyone, I have released new versions of the following three packages:

  • Sdcb.OpenVINO 0.5.1 (upgraded from 0.4.5)
  • Sdcb.OpenVINO.Extensions.OpenCvSharp4 0.2.0 (upgraded from 0.1.0)
  • Sdcb.OpenVINO.PaddleOCR 0.5.1 (upgraded from 0.3.1)

The improvements or new features are as follows:

Sdcb.OpenVINO 0.5.1 (upgraded from 0.4.5)

  • Added the NumStreams, SchedulingCoreType, and EnableHyperThreading attributes to DeviceOptions, allowing configuration of the number of inference streams (automatic by default), specifying large or small cores on a large-small core CPU (all cores are used by default), and whether to enable hyper-threading (disabled by default)
  • Added the (internal) TensorBuffer class, addressing the unclear memory ownership issue of the Tensor class, from now on Tensor will clearly own or share memory. If an array is used, a reference to an array will be created; if Mat is used, a reference to Mat will be created (choosing to use either ROI reference or clone, depending on the actual situation)
  • Changed the CreateInferRequest function in BaseModel to CreateCompiledModel. Future operations will encourage sharing of CompiledModel (rather than sharing InferRequest)

Sdcb.OpenVINO.Extensions.OpenCvSharp4 0.2.0 (upgraded from 0.1.0)

  • Added FastClone, and marked WeakRef as Obsolete
  • Removed the memory-unsafe AsByteSpan function
  • Implemented MatTensorBuffer (a class that owns or shares the ownership of Mat)

Sdcb.OpenVINO.PaddleOCR 0.5.1 (upgraded from 0.3.1)

  • All inference classes have been made thread-safe (by changing all inference classes from sharing InferRequest to sharing CompiledModel)
  • Fixed an issue that caused incorrect inference results when rotation recognition was not enabled (thanks to @ddeef for pointing it out)
  • Marked the QueuedPaddleOcrAll class as Obsolete, it is suggested to fully use PaddleOcrAll (because it's thread-safe)
  • In addition to determining whether rotation is needed, the 180-degree image classifier now also returns a confidence value

OCR Performance Results with Version 0.5.1

(Tested on i9-9880h, ChineseV3 model, static graph, with 180-degree rotation recognition enabled, other settings default, each number is the average of 100 times, in milliseconds)
159 164 155 163 161 163 159 162 170 167
Memory usage: About 396MB~1033MB, CPU utilization: About 55%~69%

Using SemaphoreSlim (2 concurrent)
166 166 174 182 185 184 175 165 183 166
Memory usage: About 328MB~344MB, CPU utilization: About 56%~58%

Using SemaphoreSlim (4 concurrent)
153 155 159 158 162 159 166 181 162 160
Memory usage: About 346MB~366MB, CPU utilization: About 60%~62%

Test results for version 0.3.1:
2 consumers, low latency mode, average time for 100 images in milliseconds:
158 153 154 156 157 160 161 157 159 163
Memory usage: About 737MB~783MB

Version 0.5.1 is able to maintain thread safety, achieve similar performance metrics with lower memory usage, and won't have crash issues with multiple consumers.

0.4.5

21 Oct 14:55
332d0e0
Compare
Choose a tag to compare

中文

新发布的包列表

  • Sdcb.OpenVINO 0.4.5
  • Sdcb.OpenVINO.Extensions.OpenCvSharp4 0.1.0
  • Sdcb.OpenVINO.PaddleOCR 0.3.1

Sdcb.OpenVINO 0.4.5有如下变化:

Sdcb.OpenVINO.Extensions.OpenCvSharp4

  • 新加的一个包,主要增强OpenVINO和OpenCv的互操作便利性
  • 提供了MatExtensions,用于一些常用的Mat操作,如Padding或normalize
  • 提供了TensorExtensions,用于方便Tensor转Mat/Mat转Tensor之类,用户的代码不再需要指针了

Sdcb.OpenVINO.PaddleOCR 0.2.3 -> 0.3.1

  • 大量代码增强,重磅推出
  • 允许Cls阶段走batch以提高性能
  • 允许检测阶段使用静态图以提高性能
  • 允许识别阶段使用静态图以提高性能
  • 为Cls阶段的返回值增加信心度
  • 增加PaddleOcrOptions类以方便上面的静态图配置
  • 将所有3个模型的预处理阶段都部分改成使用OpenVINO自带的PrePostProcessor以减少代码(性能差不多)

English Version

Newly released package list:

  • Sdcb.OpenVINO 0.4.5
  • Sdcb.OpenVINO.Extensions.OpenCvSharp4 0.1.0
  • Sdcb.OpenVINO.PaddleOCR 0.3.1

Changes in Sdcb.OpenVINO 0.4.5:

  • Added PrePostProcessor handling function to BaseModel
  • Removed CppObject class to save files, merging it into the CppPtrObject class
  • Added ov_get_and_reset_last_error function to prepare for this issue: openvinotoolkit/openvino#20536 (I raised it) for convenience in the future
  • Added FromRaw method to Tensor class for input from pointer

Features of Sdcb.OpenVINO.Extensions.OpenCvSharp4 0.1.0:

  • A new package mainly enhancing the interoperability of OpenVINO and OpenCv
  • Provided MatExtensions for some common Mat operations, such as Padding or normalize
  • Provided TensorExtensions for convenient Tensor to Mat/Mat to Tensor conversions, users' code no longer needs pointers

Improvements made from Sdcb.OpenVINO.PaddleOCR 0.2.3 -> 0.3.1:

  • Significant code enhancements, heavily promoted
  • Allowed Cls phase to go batch to improve performance
  • Allowed detection phase to use static graph to improve performance
  • Allowed recognition phase to use static graph to improve performance
  • Added confidence level to the return value of Cls phase
  • Added PaddleOcrOptions class to facilitate the above static graph configuration
  • Partially changed the preprocessing stage of all three models to use OpenVINO's built-in PrePostProcessor to reduce code (performance is similar)

0.4.1

17 Oct 01:10
Compare
Choose a tag to compare

Changes/Improvements:

  1. The default device has been changed from CPU to AUTO. AUTO will choose between CPU or GPU based on the actual situation. Of course, I believe it may also reduce performance. You can specify CPU to restore the previous behavior (thanks to newbie).
  2. Provided DeviceOptions overload to the OVCore.CompileModel method, making it easier to set device attributes.
  3. Provided a friendlier FileNotFoundException error when the model file does not exist in ReadModel/CompileModel (thanks to lw for the suggestion).

修改/优化:

  1. 将默认设备从CPU改为了AUTO,AUTO会根据实际情况选择CPU或GPU,当然我认为它也有可能降低性能,可以指定CPU以恢复之前的行为(感谢 newbie 大佬)
  2. 向OVCore.CompileModel方法提供了DeviceOptions重载,这会更方便设置设备属性
  3. 向ReadModel/CompileModel在模型文件不存在时,提供了更友好的FileNotFoundException报错 (感谢 lw 大佬提出)