This project provide following packages:
Package | Link |
---|---|
DevKen.YoloPredictor | |
DevKen.YoloPredictor.Yolov5 | |
DevKen.YoloPredictor.OpenCvBridge |
This project is designed to make YOLO intergration with .NET fast, easy and convenient. Programmers don't have to understand details about YOLO or ML, just feed the Predictor with trained moudle and images, then receive the results.
DO NOT do that. This project is still under development and comes with NO guarantee.
Post issues if any problems are found.
//Create a predictor by providing modulepath and a backend.
//Install corresponding OnnxRuntime nuget package.
//For example, you need Microsoft.ML.OnnxRuntime.Gpu for CUDA.
YoloPredictor predictor = new YoloPredictorV5(modulepath, backend:YoloPredictorV5.Backend.CUDA);
//Predict on a Bitmap, then apply NMS and Confidence filter.
var detresult = predictor.Predict((Bitmap)Bitmap.FromFile(picture)).NMSFilter().ConfidenceFilter();
Opencv read camera and run prediction.
//Create a predictor by providing modulepath and a backend.
YoloPredictor predictor = new YoloPredictorV5(modulepath, backend:YoloPredictorV5.Backend.CUDA);
//Open video device
VideoCapture vc = new VideoCapture(0);
while (true)
{
//If frame presents
if (vc.Read(image))
{
//Run detector on that frame, then apply NMSFilter and ConfidenceFilter.
var detresult = predictor.Predict(image).NMSFilter().ConfidenceFilter();
//** Do something with detresult here **
}
}