LTW.YoloDotNet.Cuda.TensorRT.Execution.Provider 1.1.1-aotfix.1

This is a prerelease version of LTW.YoloDotNet.Cuda.TensorRT.Execution.Provider.
dotnet add package LTW.YoloDotNet.Cuda.TensorRT.Execution.Provider --version 1.1.1-aotfix.1
                    
NuGet\Install-Package LTW.YoloDotNet.Cuda.TensorRT.Execution.Provider -Version 1.1.1-aotfix.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="LTW.YoloDotNet.Cuda.TensorRT.Execution.Provider" Version="1.1.1-aotfix.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="LTW.YoloDotNet.Cuda.TensorRT.Execution.Provider" Version="1.1.1-aotfix.1" />
                    
Directory.Packages.props
<PackageReference Include="LTW.YoloDotNet.Cuda.TensorRT.Execution.Provider" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add LTW.YoloDotNet.Cuda.TensorRT.Execution.Provider --version 1.1.1-aotfix.1
                    
#r "nuget: LTW.YoloDotNet.Cuda.TensorRT.Execution.Provider, 1.1.1-aotfix.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package LTW.YoloDotNet.Cuda.TensorRT.Execution.Provider@1.1.1-aotfix.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=LTW.YoloDotNet.Cuda.TensorRT.Execution.Provider&version=1.1.1-aotfix.1&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=LTW.YoloDotNet.Cuda.TensorRT.Execution.Provider&version=1.1.1-aotfix.1&prerelease
                    
Install as a Cake Tool

信息

YoloDotNet 使用模块化执行器在不同硬件后端上运行推理。 每个执行器都针对特定平台或加速器,并且可能需要额外的系统级依赖(如运行时、驱动或 SDK)。

仅安装 NuGet 包并不总是足够——正确配置取决于所选执行器和目标系统。
本文档说明 CUDA 与 TensorRT 执行器 的安装、环境要求和使用方式。

核心库要求

所有执行器都依赖核心 YoloDotNet 包,其中包含共享的推理管线、模型和 API。

NuGet 包

dotnet add package YoloDotNet

执行器 - CUDA 与 TensorRT

CUDA 与 TensorRT 执行器通过 ONNX Runtime 的 CUDA 后端,在 NVIDIA GPU 上启用 GPU 加速推理。
可选启用 NVIDIA TensorRT,以进一步优化模型并获得更高吞吐和更低延迟。

⚠️ 注意
此执行器仅支持 Windows 和 Linux。
macOS 不支持 CUDA 和 TensorRT。

环境要求

重要
此执行器依赖原生 CUDA 与 cuDNN 库。
仅安装 NuGet 包并不足够,必须正确安装系统级依赖。

安装(Windows)

  • CUDA

    从 NVIDIA 官网下载并安装以下组件:

    安装 cuDNN 后,找到包含 cuDNN DLL 文件的目录。 通常路径为:

    C:\Program Files\NVIDIA\CUDNN\v9.x\bin\v12.x
    

    (请将 v9.x 和 v12.x 替换为你系统中的实际版本)

    将 cuDNN 添加到系统 PATH:

    1. 复制 cuDNN bin\v12.x 目录的完整路径

    2. 在 Windows 搜索中输入并打开 Edit the system environment variables

    3. 点击 Environment Variables

    4. System variables 中选择 Path,点击 Edit

    5. 点击 New,粘贴刚才复制的 cuDNN 路径

    6. 点击 OK 保存并关闭所有窗口

    7. 重启系统

  • TensorRT(可选)

    TensorRT 是 NVIDIA 的高性能推理引擎,可通过针对特定 GPU 优化模型显著提升性能。

    1. 下载 适用于 CUDA 12.xTensorRT 10.13.3

    2. 解压压缩包到系统中的某个目录

    3. 找到解压后 TensorRT 目录中的 lib 文件夹

    4. 复制该 lib 文件夹的完整路径

    5. 将该路径加入系统 PATH 环境变量(流程同 CUDA 安装步骤)

    6. 重启系统

安装(Linux)

NuGet 包

dotnet add package YoloDotNet.ExecutionProvider.Cuda

YoloDotNet.ExecutionProvider.Cuda v1.1 需要 YoloDotNet 4.1 版本。

使用示例:

using YoloDotNet;
using YoloDotNet.ExecutionProvider.Cuda;

using var yolo = new Yolo(new YoloOptions
{
    ExecutionProvider = new CudaExecutionProvider(
        model: "path/to/model.onnx",

        // GPU 设备索引(默认:0)
        gpuId: 0,

        // 可选 TensorRT 配置,用于获得更高性能
        trtConfig: new TensorRt
        {
            Precision = TrtPrecision.FP16,
            EngineCachePath = "path/to/cache/folder",
            EngineCachePrefix = "MyCachePrefix"
        }
    ),

    // ...其他选项
});

// 更多高级配置可参考 TensorRT 示例项目。

说明与建议

  • 如果你只需要简单、低门槛的 GPU 加速,使用 CUDA 即可。
  • 如果你追求极致性能并能管理引擎缓存,建议启用 TensorRT。
  • TensorRT 引擎会按模型与配置首次生成,后续运行将复用缓存。
  • macOS 不支持 CUDA 与 TensorRT。
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.1-aotfix.1 47 5/6/2026