![]() |
VOOZH | about |
dotnet add package IntptrMax.YoloSharp --version 1.1.24
NuGet\Install-Package IntptrMax.YoloSharp -Version 1.1.24
<PackageReference Include="IntptrMax.YoloSharp" Version="1.1.24" />
<PackageVersion Include="IntptrMax.YoloSharp" Version="1.1.24" />Directory.Packages.props
<PackageReference Include="IntptrMax.YoloSharp" />Project file
paket add IntptrMax.YoloSharp --version 1.1.24
#r "nuget: IntptrMax.YoloSharp, 1.1.24"
#:package IntptrMax.YoloSharp@1.1.24
#addin nuget:?package=IntptrMax.YoloSharp&version=1.1.24Install as a Cake Addin
#tool nuget:?package=IntptrMax.YoloSharp&version=1.1.24Install as a Cake Tool
Train and run YOLO models in pure C# with TorchSharp.
No Python required — from training to inference, everything stays inside .NET.
Whether you're building a desktop application, a cloud service, or an edge device solution, YoloSharp keeps your stack consistent and maintainable.
🚀 Added Net Standard 2.0 support.
🚀 Added End-to-End (End2End) support for both training and inference.
🚀 Added warm‑up scheduling for stable training start.
🚀 Added rectangle‑resize transform for validation (preserves aspect ratio).
🚀 Added option to disable mosaic augmentation during training.
🚀 Added bias initialization for detection head to improve convergence.
🚀 Replaced CosineAnnealingLR with LambdaLR for more flexible learning rate scheduling.
🐛 Fixed angle loss calculation for oriented bounding boxes (OBB).
🐛 Fixed HSV transform implementation.
2026/06/01
🚀 Added Net Standard 2.0 support.
2026/05/31
🚀 Added End-to-End (End2End) support for both training and inference.
🐛 Fixed angle loss calculation for oriented bounding boxes (OBB).
2026/05/07
🚀 Added data augmentation: horizontal flip, vertical flip, RandomPerspective.
🐛 Fixed Mosaic4 implementation.
2026/03/26
🚀 Added training metrics curves.
2026/03/06
🚀 Configurable training & prediction.
🚀 More metrics for validation.
2026/02/03
🚀 Early stopping.
🚀 HSV transform.
🚀 Training logs.
2026/01/20
🚀 Mixed precision trainer (simple AMP).
🚀 Tqdm support.
🚀 BF16 precision.
Get the official YOLO checkpoints below.
| model | n | s | m | l | x |
|---|---|---|---|---|---|
| yolov5 | yolov5n | yolov5s | yolov5m | yolov5l | yolov5x |
| yolov5u | yolov5nu | yolov5su | yolov5mu | yolov5lu | yolov5xu |
| yolov8 | yolov8n | yolov8s | yolov8m | yolov8l | yolov8x |
| yolov11 | yolov11n | yolov11s | yolov11m | yolov11l | yolov11x |
| model | n | s | m | l | x |
|---|---|---|---|---|---|
| yolov8 | yolov8n-seg | yolov8s-seg | yolov8m-seg | yolov8l-seg | yolov8x-seg |
| yolov11 | yolov11n-seg | yolov11s-seg | yolov11m-seg | yolov11l-seg | yolov11x-seg |
dotnet add package IntptrMax.YoloSharp
You also need to add one of the LibTorch packages (version 2.5.1.0) and OpenCvSharp4.runtime:
libtorch-cpulibtorch-cuda-12.1libtorch-cuda-12.1-win-x64libtorch-cuda-12.1-linux-x64string preTrainedModelPath = @"..\..\..\Assets\PreTrainedModels\yolov8n-obb.bin"; // Pretrained model path.
string predictImagePath = @"..\..\..\Assets\TestImage\trucks.jpg";
string dataRootPath = @"..\..\..\Assets\datasets\dotav1";
string trainDataPath = @"train.txt";
string valDataPath = @"val.txt";
Mat predictImage = Cv2.ImRead(predictImagePath);
// Create a Yolo config
Config config = new Config
{
DeviceType = DeviceType.CUDA,
ScalarType = ScalarType.BFloat16,
RootPath = dataRootPath,
TrainDataPath = trainDataPath,
ValDataPath = valDataPath,
YoloType = YoloType.Yolov8,
YoloSize = YoloSize.n,
TaskType = TaskType.Obb,
ImageProcessType = ImageProcessType.Mosiac,
ImageSize = 640,
BatchSize = 16,
NumberClass = 15,
PredictThreshold = 0.3f,
IouThreshold = 0.7f,
Workers = 4,
Epochs = 100,
LearningRate = 1e-4f,
Patience = 50,
KeyPoint_Num = 21,
KeyPoint_Dim = 3,
};
// Create a yolo task.
YoloTask yoloTask = new YoloTask(config);
// Load pre-trained model. If you don't want to use pre-trained model, skip the step.
yoloTask.LoadModel(preTrainedModelPath, skipNcNotEqualLayers: true);
// Train model
yoloTask.Train();
// Predict image, if the model is not trained or loaded, it will use random weight to predict.
List<YoloResult> predictResult = yoloTask.ImagePredict(predictImage);
| Model | Output |
|---|---|
| YOLOv8n (detection) | 👁 zidane |
| YOLOv8n‑seg | 👁 bus |
| YOLOv8n‑obb | 👁 trucks |
| YOLOv8n‑pose | 👁 tennis |
Enjoy YOLO entirely in .NET – no Python needed!
Contributions and feedback are welcome!
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 is compatible. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 was computed. |
| .NET Framework | net461 net461 was computed. net462 net462 was computed. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.