Run Ultralytics's YoloV5 in C# by using LibTorch
The C++ part of this project is highly reference to ncdhz's C++ YoloV5 Library
can reference to: YoloV5TorchTest/YoloV5TorchTest
Download libtorch-win-shared-with-deps-1.10.2+cu113
Download opencv 4.6.0
Download and install cuda 11.3
Download and install cudnn 8.5.0.96
Get YoloV5Torch.dll from YoloV5TorchTest/YoloV5TorchTest/
Get YoloV5TorchCpp.dll from YoloV5TorchTest/YoloV5TorchTest/
Create a C# program and add YoloV5Torch.dll to the reference
All dll from (libtorch-win-shared-with-deps-1.10.2+cu113/libtorch/lib) &
opencv/build/x64/vc15/bin/opencv_world460.dll &
YoloV5Torch.dll &
YoloV5TorchCpp.dll
should put in the same directory as your C# program
YoloV5Torch can directly build
Download libtorch
Download opencv
Download and install cuda with version same as libtorch
{cudaDirectory}/include
{libtorchDirectory}/libtorch/include
{libtorchDirectory}/libtorch/include/torch/csrc/api/include
{opencvDirectory}/build/include/
{cudaDirectory}/lib/x64
{libtorchDirectory}/libtorch/lib
{opencvDirectory}/build/x64/vc15/lib
opencv_world460.lib
AND
All .lib from {libtorchDirectory}/libtorch/lib
LibTorch (1.10.2+cu113)
OpenCv (4.6.0)
Cuda (11.3)
https://github.com/ultralytics/yolov5
https://github.com/ncdhz/YoloV5-LibTorch