diff --git a/README.md b/README.md index 7e1c02b..5409db3 100644 --- a/README.md +++ b/README.md @@ -10,9 +10,33 @@ This project provide following packages: ------ ## What is this? 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. -## Use in critical projects? -DO NOT do that. This project is still under development and comes with NO guarantee. -Post issues if any problems are found. + +## Reproduce under DirectML +In this section, I will explain some details on how to use this repo. +### What is DirectML? +DirectML is a new feature in DirectX 12. It allows most kind of GPUs to be used to accelerate machine learning, even some of those embeded into CPUs. +### Envirounment +When editing this, I just verified that the 3 packages in the table above is all I need to run YOLOv5 via DirectML on `Intel(R) Iris(R) Xe Graphics` in my laptop. It's running `Windows11 22H2 version 22621.1848`, with `Windows Feature Experience Pack 1000.22642.1000.0`. + +Packages: +|Package|Version| +|-------|-------| +|DevKen.YoloPredictor|22.11.322.18| +|DevKen.YoloPredictor.Yolov5|22.11.322.18| +|DevKen.YoloPredictor.OpenCvBridge|22.11.322.4| +|OpenCvSharp4|4.7.0.20230115| +|OpenCvSharp4.runtime.win|4.7.0.20230115| +|OpenCvSharp4.Extentions|4.6.0.20220608| +### Export onnx file from YOLOv5 +Following command is verified to export an onnx file works well with this repo. +Remember to replace `PATH_TO_TRAINED_WEIGHT_PT` with your weight file (`latest.pt` or `best.pt`), +replace `PATH_TO_DATASET_CONFIG_FILE_YML` with your `dataset.yml` file. +Do **NOT** use `--dynamic` if you want to use auto-configure function of the repo, as that prevent some metadata from being written into the onnx file. You have to fill all parameters when creating the YoloPredictor if you use `--dynamic`. +`--opset 15` is required because the onnx execution engine we use will complain about opset>15 and throw an exception. +``` +python export.py --weights PATH_TO_TRAINED_WEIGHT_PT --data PATH_TO_DATASET_CONFIG_FILE_YML --include onnx --opset 15 +``` +Then use the code examples above, change `backend:YoloPredictorV5.Backend.CUDA` to `backend:YoloPredictorV5.Backend.DirectML`. ## Usage example ### Predict on Bitmap ```