OCDet: Object Center Detection via Bounding Box-Aware Heatmap Prediction on Edge Devices with NPUs
Introduction
We introduce OCDet, a lightweight Object Center Detection framework optimized for edge devices with NPUs. OCDet predicts heatmaps representing object center probabilities and extracts center points through peak identification. Unlike prior methods using fixed Gaussian distribution, we introduce Generalized Centerness (GC) to generate ground truth heatmaps from bounding box annotations, providing finer spatial details without additional manual labeling. Built on NPU-friendly Semantic FPN with MobileNetV4 backbones, OCDet models are trained by our Balanced Continuous Focal Loss (BCFL), which alleviates data imbalance and focuses training on hard negative examples for probability regression tasks. Leveraging the novel Center Alignment Score (CAS) with Hungarian matching, we demonstrate that OCDet consistently outperforms YOLO11 in object center detection, achieving up to 23% higher CAS while requiring 42% fewer parameters, 34% less computation, and 64% lower NPU latency. When compared to keypoint detection frameworks, OCDet achieves substantial CAS improvements up to 186% using identical models.
To perform center detection specifically for the “person” category on a single image (images/000000032081.jpg) using PCDet-N on a CPU, execute the following command:
OCDet: Object Center Detection via Bounding Box-Aware Heatmap Prediction on Edge Devices with NPUs
Introduction
We introduce OCDet, a lightweight Object Center Detection framework optimized for edge devices with NPUs. OCDet predicts heatmaps representing object center probabilities and extracts center points through peak identification. Unlike prior methods using fixed Gaussian distribution, we introduce Generalized Centerness (GC) to generate ground truth heatmaps from bounding box annotations, providing finer spatial details without additional manual labeling. Built on NPU-friendly Semantic FPN with MobileNetV4 backbones, OCDet models are trained by our Balanced Continuous Focal Loss (BCFL), which alleviates data imbalance and focuses training on hard negative examples for probability regression tasks. Leveraging the novel Center Alignment Score (CAS) with Hungarian matching, we demonstrate that OCDet consistently outperforms YOLO11 in object center detection, achieving up to 23% higher CAS while requiring 42% fewer parameters, 34% less computation, and 64% lower NPU latency. When compared to keypoint detection frameworks, OCDet achieves substantial CAS improvements up to 186% using identical models.
Performance
Model Zoo
COCO 80-class Object Center Detection (OCDet)
(M)
(G)
i.MX 8M Plus
(ms)
Person Center Detection (PCDet)
(M)
(G)
i.MX 8M Plus
(ms)
Model Configurations
The model configurations are organized and stored in the
configs
directory. This folder is structured as follows:configs/cmap
contains configurations for Person Center Detection (PCDet) models, tailored for detecting person only.configs/cmap_c80
includes configurations for Object Center Detection (OCDet) models trained on COCO’s 80 object classes.Install
1. Create a Conda Environment
2. Install the Required Dependencies
3. Install mmdetection and mmsegmentation
Inference
1. Download Model Weights
Download the pretrained weights from the Model Zoo and save them in
weights
directory.2. Run inference on GPU/CPU
You can perform inference with any model on either a GPU or CPU. Below are examples demonstrating both scenarios.
Object Center Detection with OCDet-X on GPU
To detect centers for 80 COCO categories across all images in the images folder using OCDet-X on a GPU, use the following command:
Person Center Detection with OCDet-N on CPU
To perform center detection specifically for the “person” category on a single image (images/000000032081.jpg) using PCDet-N on a CPU, execute the following command:
Training
1. Prepare Dataset
Download and extract the COCO Dataset. The directory structure should look like this:
2. Generate Ground Truth Heatmaps
Generate ground truth heatmap for both
val2017
andtrain2017
images using the proposed Generalized Centerness:Generated heatmaps are saved in
COCO_FOLDER/cmaps
3. Run Training Script
For example, to train OCDet-N:
The best model is saved in
torch_models
folder locallyEvaluation
For example, to evaluate the OCDet-S model for 80-class object center detection on COCO
val2017
:NPU Inference
To run inference on NPU, trained PyTorch models must first be converted to TensorFlow Lite (tflite) with uint8 quantization.
1. Model Conversion and Quantization
Follow the examples provided in convert.ipynb
2. Inference on NPU
Check the script tflite_inference.py
Qualitative Results
Comparison of Ground Truth (left), YOLO11x (center), and OCDet-X (right)
More Visualizations of OCDet-X’s Predictions