DirectML Object Detection Samples

Explore powerful examples of implementing object detection using DirectML on Windows.

Overview

DirectML provides a high-performance, hardware-accelerated machine learning inference engine for Windows. This section showcases practical samples that demonstrate how to leverage DirectML for various object detection tasks. From popular models like YOLO to custom implementations, these samples are designed to help you accelerate your AI development on Windows.

Key Concepts

Featured Samples

YOLOv4 Object Detection

Implement and accelerate the YOLOv4 object detection model using DirectML. Detect objects in real-time with high accuracy.

View Sample

SSD Object Detection

Discover how to use the Single Shot Detector (SSD) model for efficient object detection with DirectML acceleration.

View Sample

Custom Object Detection Model

Learn to package and deploy your own object detection models with DirectML for custom use cases.

View Sample

Performance Tuning Guide

Tips and techniques for optimizing your object detection pipelines for maximum performance with DirectML.

View Guide

Getting Started

To run these samples, you'll need:

Each sample provides detailed instructions on setup, build, and execution. We recommend starting with the YOLOv4 sample for a comprehensive understanding.

Code Snippet Example (Conceptual)

Here's a simplified look at how DirectML might be used for inference:


// Initialize DirectML Device and Operator Graph
IDMLDevice* dmlDevice;
// ... create DML device ...

IDMLOperatorInitializer* initializer;
// ... create initializer ...

IDMLOperator* tensorObjectDetectionOp;
// ... create tensor object detection operator ...

// Prepare input tensors
DML_BUFFER_BINDING inputBinding = { inputBuffer, inputBuffer->GetSize() };
// ... bind input data ...

// Prepare output tensors
DML_BUFFER_BINDING outputBinding = { outputBuffer, outputBuffer->GetSize() };
// ... bind output buffer ...

// Create an execution list
IDMLCommandRecorder* commandRecorder;
// ... create command recorder ...

IDMLCommandList* commandList;
// ... create command list ...

// Record the dispatch command
commandRecorder->RecordDispatch(commandList, tensorObjectDetectionOp, &inputBinding, &outputBinding, nullptr);

// Close and execute the command list
// ... execute ...

// Process the results from the output buffer