README.md

September 7, 2026 ยท View on GitHub

DETRPose: Real-Time End-to-End Multi-Person Pose Estimation via Modified Transformer Decoder and Novel Denoising Keypoints

colab arxiv colab

๐Ÿ“„ This is the official implementation of the paper:
DETRPose: Real-Time End-to-End Multi-Person Pose Estimation via Modified Transformer Decoder and Novel Denoising Keypoints

Sebastian Janampa and Marios Pattichis

The University of New Mexico
Department of Electrical and Computer Engineering


DETRPose is the first real-time end-to-end transformer model for multi-person pose estimation, achieving outstanding results on the COCO and CrowdPose datasets. In this work, we propose a new denoising technique suitable for pose estimation that uses the Object Keypoint Similarity (OKS) metric to generate positive and negative queries. Additionally, we develop a new classification head and a new classification loss that are variations of the LQE head and the varifocal loss used in D-FINE.

Video We conduct object detection using DETRPose to show its efficiency and low latency.

https://github.com/user-attachments/assets/de3f4ee3-182b-43f8-a40b-1aa3bee54e51

๐Ÿš€ Updates

Model Zoo

COCO val2017

ModelAPAP50AP75ARAR50#ParamsLatencyGFLOPsconfigcheckpointHF ๐Ÿค— checkpoint
DETRPose-N57.281.761.464.487.94.1 M2.80 ms9.3py57.2HF
DETRPose-S67.087.672.873.592.411.5 M4.99 ms33.1py67.0HF
DETRPose-M69.489.275.475.593.720.8 M7.01 ms67.3py69.4HF
DETRPose-L72.590.679.078.795.032.8 M9.50 ms107.1py72.5HF
DETRPose-X73.390.579.479.494.973.3 M13.31 ms239.5py73.3HF

COCO test-dev2017

ModelAPAP50AP75ARAR50#ParamsLatencyGFLOPsconfigcheckpointHF ๐Ÿค— checkpoint
DETRPose-N56.783.161.164.489.34.1 M2.80 ms9.3py56.7HF
DETRPose-S66.088.372.073.293.311.5 M4.99 ms33.1py66.0HF
DETRPose-M68.490.174.875.194.420.8 M7.01 ms67.3py88.3HF
DETRPose-L71.291.278.178.195.732.8 M9.50 ms107.1py71.2HF
DETRPose-X72.291.479.378.895.773.3 M13.31 ms239.5py72.2HF

CrowdPose test

ModelAPAP50AP75APEAPMAPH#ParamsLatencyGFLOPsconfigcheckpointHF ๐Ÿค— checkpoint
DETRPose-N56.080.759.665.056.646.64.1 M2.72 ms8.8py57.2HF
DETRPose-S67.488.672.974.768.159.311.5 M4.80 ms31.3py67.0HF
DETRPose-M72.091.077.878.672.664.520.7 M6.86 ms64.9py69.4HF
DETRPose-L73.391.679.479.574.066.132.7 M9.03 ms103.5py72.5HF
DETRPose-X75.192.181.381.375.768.173.3 M13.01 ms232.3py73.3HF

Notes:

  • Latency is evaluated on a single Tesla V100 GPU with batchsize=1batch\\_size = 1, fp16fp16, and TensorRT==8.6.3TensorRT==8.6.3.

Quick start

Open In Colab Open in Spaces

Setup

conda create -n detrpose python=3.11.9
conda activate detrpose
pip install -r requirements.txt

Data Preparation

Create a folder named data to store the datasets

configs
src
tools
data
  โ”œโ”€โ”€ COCO2017
    โ”œโ”€โ”€ train2017
    โ”œโ”€โ”€ val2017
    โ”œโ”€โ”€ test2017
    โ””โ”€โ”€ annotations
  โ””โ”€โ”€ crowdpose
    โ”œโ”€โ”€ images
    โ””โ”€โ”€ annotations

COCO2017 dataset Download COCO2017 from their [website](https://cocodataset.org/#download)
CrowdPose dataset Download Crowdpose from their [github](https://github.com/jeffffffli/CrowdPose), or use the following command
pip install gdown # to download files from google drive
mkdir crowdpose
cd crowdpose
gdown 1VprytECcLtU4tKP32SYi_7oDRbw7yUTL # images
gdown 1b3APtKpc43dx_5FxizbS-EWGvd-zl7Lb # crowdpose_train.json
gdown 18-IwNa6TOGQPE0RqGNjNY1cJOfNC7MXj # crowdpose_val.json
gdown 13xScmTWqO6Y6m_CjiQ-23ptgX9sC-J9I # crowdpose_trainval.json
gdown 1FUzRj-dPbL1OyBwcIX2BgFPEaY5Yrz7S # crowdpose_test.json
unzip images.zip

Usage

COCO2017 dataset
  1. Set Model
export model=l # n s m l x
  1. Training
CUDA_VISIBLE_DEVICES=0,1,2,3 torchrun --master_port=7777 --nproc_per_node=4  train.py --config_file configs/detrpose/detrpose_hgnetv2_${model}.py --device cuda --amp --pretrain dfine_${model}_obj365 

if you choose model=n, do

CUDA_VISIBLE_DEVICES=0,1,2,3 torchrun --master_port=7777 --nproc_per_node=4  train.py --config_file configs/detrpose/detrpose_hgnetv2_n.py --device cuda --amp --pretrain dfine_n_obj365 
  1. Testing (COCO2017 val)
CUDA_VISIBLE_DEVICES=0,1,2,3 torchrun --master_port=7777 --nproc_per_node=4  train.py --config_file configs/detrpose/detrpose_hgnetv2_${model}.py --device cuda --amp --resume <PTH_FILE_PATH> --eval
  1. Testing (COCO2017 test-dev)
CUDA_VISIBLE_DEVICES=0,1,2,3 torchrun --master_port=7777 --nproc_per_node=4  train.py --config_file configs/detrpose/detrpose_hgnetv2_${model}.py --device cuda --amp --resume <PTH_FILE_PATH> --test

After running the command. You'll get a file named results.json. Compress it and submit it to the COCO competition website

  1. Replicate results (optional)
# First, download the official weights
wget https://github.com/SebastianJanampa/DETRPose/releases/download/model_weights/detrpose_hgnetv2_${model}.pth

# Second, run evaluation
CUDA_VISIBLE_DEVICES=0,1,2,3 torchrun --master_port=7777 --nproc_per_node=4  train.py --config_file configs/detrpose/detrpose_hgnetv2_${model}.py --device cuda --amp --resume detrpose_hgnetv2_${model}.pth --eval
CrowdPose dataset
  1. Set Model
export model=l # n s m l x
  1. Training
CUDA_VISIBLE_DEVICES=0,1,2,3 torchrun --master_port=7777 --nproc_per_node=4  train.py --config_file configs/detrpose/detrpose_hgnetv2_${model}_crowdpose.py --device cuda --amp --pretrain dfine_${model}_obj365 

if you choose model=n, do

CUDA_VISIBLE_DEVICES=0,1,2,3 torchrun --master_port=7777 --nproc_per_node=4  train.py --config_file configs/detrpose/detrpose_hgnetv2_n_crowdpose.py --device cuda --amp --pretrain dfine_n_obj365 
  1. Testing
CUDA_VISIBLE_DEVICES=0,1,2,3 torchrun --master_port=7777 --nproc_per_node=4  train.py --config_file configs/detrpose/detrpose_hgnetv2_${model}_crowdpose.py --device cuda --amp --resume <PTH_FILE_PATH> --eval
  1. Replicate results (optional)
# First, download the official weights
wget https://github.com/SebastianJanampa/DETRPose/releases/download/model_weights/detrpose_hgnetv2_${model}_crowdpose.pth

# Second, run evaluation
CUDA_VISIBLE_DEVICES=0,1,2,3 torchrun --master_port=7777 --nproc_per_node=4  train.py --config_file configs/detrpose/detrpose_hgnetv2_${model}_crowdpose.py --device cuda --amp --resume detrpose_hgnetv2_${model}_crowdpose.pth --eval

Lambda instances

All latency experiments using Lambda.ai instances. We have provided two README files

  1. to run a TensorRT container in a Lambda.ai instance
  2. to install a TensorRT .deb in a Lambda.ai instance

Tools

Deployment
  1. Setup
pip install -r tools/inference/requirements.txt
export model=l  # n s m l x
  1. Export onnx For COCO model
python tools/deployment/export_onnx.py --check -c configs/detrpose/detrpose_hgnetv2_${model}.py -r detrpose_hgnetv2_${model}.pth

For CrowdPose model

python tools/deployment/export_onnx.py --check -c configs/detrpose/detrpose_hgnetv2_${model}_crowdpose.py -r detrpose_hgnetv2_${model}_crowdpose.pth
  1. Export tensorrt For a specific file
trtexec --onnx="model.onnx" --saveEngine="model.engine" --fp16

or, for all files inside a folder

python tools/deployment/export_tensorrt.py
Inference (Visualization)

Check the inference_only branch for inference, which requires fewer libraries to run.

  1. Setup
export model=l  # n s m l x
  1. Inference (onnxruntime / tensorrt / torch)

Inference on images and videos is supported.

For a single file

# For COCO model
python tools/inference/onnx_inf.py --onnx detrpose_hgnetv2_${model}.onnx --input examples/example1.jpg --annotator COCO
python tools/inference/trt_inf.py --trt detrpose_hgnetv2_${model}.engine --input examples/example1.jpg --annotator COCO
python tools/inference/torch_inf.py -c configs/detrpose/detrpose_hgnetv2_${model}.py -r <checkpoint.pth> --input examples/example1.jpg --device cuda:0 

# For CrowdPose model
python tools/inference/onnx_inf.py --onnx detrpose_hgnetv2_${model}_crowdpose.onnx --input examples/example1.jpg --annotator CrowdPose
python tools/inference/trt_inf.py --trt detrpose_hgnetv2_${model}_crowdpose.engine --input examples/example1.jpg --annotator CrowdPose
python tools/inference/torch_inf.py -c configs/detrpose/detrpose_hgnetv2_${model}_crowdpose.py -r <checkpoint.pth> --input examples/example1.jpg --device cuda:0 

For a folder

# For COCO model
python tools/inference/onnx_inf.py --onnx detrpose_hgnetv2_${model}.onnx --input examples --annotator COCO
python tools/inference/trt_inf.py --trt detrpose_hgnetv2_${model}.engine --input examples --annotator COCO
python tools/inference/torch_inf.py -c configs/detrpose/detrpose_hgnetv2_${model}.py -r <checkpoint.pth> --input examples --device cuda:0 

# For CrowdPose model
python tools/inference/onnx_inf.py --onnx detrpose_hgnetv2_${model}_crowdpose.onnx --input examples --annotator CrowdPose
python tools/inference/trt_inf.py --trt detrpose_hgnetv2_${model}_crowdpose.engine --input examples --annotator CrowdPose
python tools/inference/torch_inf.py -c configs/detrpose/detrpose_hgnetv2_${model}_crowdpose.py -r <checkpoint.pth> --input examples --device cuda:0

Benchmark
  1. Setup
pip install -r tools/benchmark/requirements.txt
export model=l  # n s m l
  1. Model FLOPs, MACs, and Params
# For COCO model
python tools/benchmark/get_info.py --config configs/detrpose/detrpose_hgnetv2_${model}.py

# For COCO model
python tools/benchmark/get_info.py --config configs/detrpose/detrpose_hgnetv2_${model}_crowdpose.py
  1. TensorRT Latency
python tools/benchmark/trt_benchmark.py --infer_dir ./data/COCO2017/val2017 --engine_dir trt_engines
  1. Pytorch Latency
# For COCO model
python tools/benchmark/torch_benchmark.py -c ./configs/detrpose/detrpose_hgnetv2_${model}.py --resume detrpose_hgnetv2_${model}.pth --infer_dir ./data/COCO/val2017

# For CrowdPose model
python tools/benchmark/torch_benchmark.py -c ./configs/detrpose/detrpose_hgnetv2_${model}_crowdpose.py --resume detrpose_hgnetv2_${model}_crowdpose.pth --infer_dir ./data/COCO/val2017

Citation

If you use DETRPose or its methods in your work, please cite the following BibTeX entries:

bibtex
@misc{janampa2026detrposerealtimeendtoendmultiperson,
      title={DETRPose: Real-Time End-to-End Multi-Person Pose Estimation via Modified Transformer Decoder and Novel Denoising Keypoints}, 
      author={Sebastian Janampa and Marios Pattichis},
      year={2026},
      eprint={2506.13027},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2506.13027}, 
}

Acknowledgement

This work was supported in part by Lambda.ai.

Our work is built upon DEIM, D-FINE, Detectron2, and GroupPose.

โœจ Feel free to contribute and reach out if you have any questions! โœจ