Detection accuracy is not automatic — it is the result of matching inference-time configuration to how the model was trained.
Even a correctly trained model can produce poor results if preprocessing, resize behavior, or thresholds do not align with training assumptions.
There is no one-size-fits-all configuration. Optimal settings depend on your dataset, training pipeline, and application requirements.
-
Image Preprocessing & Resize Mode
- Controlled via
ImageResize. - Resize behavior must match the preprocessing used during training. A mismatch here is one of the most common causes of degraded detection accuracy.
ℹ️ Most Ultralytics YOLO models are trained using proportional resizing with padding (letterboxing).
ImageResize.Proportionalis the default in YoloDotNet and is the correct choice in the majority of cases.Important:
Selecting the wrong resize mode can reduce detection accuracy. Change this only if you know your training pipeline resized images without preserving aspect ratio. - Controlled via
-
Sampling Options
-
Controlled via
SamplingOptions. -
Define how pixel data is resampled when resizing (e.g.,
Cubic,NearestNeighbor,Bilinear). This choice has a direct impact on the accuracy of your detections, as different resampling methods can slightly alter object shapes and edges. -
YoloDotNet default:
SamplingOptions = new SKSamplingOptions(SKFilterMode.Nearest, SKMipmapMode.None);
This default prioritizes deterministic behavior and performance while matching common training pipelines. Changing the sampling method may improve visual quality, but can subtly affect detection accuracy.
💡 Tip: Check the ResizeImage Benchmarks for examples of different
SamplingOptionsand to help you choose the best settings for your needs.
-
-
Confidence & IoU Thresholds
Detection results are filtered using thresholds you configure at inference time:
- Confidence
Minimum probability required for a detection to be considered valid. - IoU (Intersection-over-Union)
Controls how overlapping detections are merged or suppressed.
General guidance:
- Too low → more false positives.
- Too high → more missed detections.
Fine-tune these values based on your dataset, object density, and tolerance for false positives.
- Confidence
💡 Recommended approach: Start with the defaults, verify results on a representative validation set, then adjust
ImageResize,SamplingOptions, andConfidence/IoUthresholds incrementally.
Visualization does not affect inference accuracy, but YoloDotNet provides full control over how results are rendered.
- Custom Colors – use built-in class colors or define your own
- Font Style & Size – fully configurable label rendering
- Custom Fonts – load your own font files for overlays
For advanced customization, see the extension methods in the main YoloDotNet repository — they provide a solid, production-ready foundation.
Practical drawing and rendering examples are available in the demo project source code.

