NVIDIA-AI-IOT / cuDLA-samples

YOLOv5 on Orin DLA
Other
180 stars 17 forks source link

YOLOv5s PQT/QAT - 0% mAP when infer on TensorRT int8 .engine models #27

Closed olibartfast closed 7 months ago

olibartfast commented 7 months ago

Hi there, I'm trying to replicate the PQT and QAT procedure by following the Export Readme step by step.

I can reproduce the results on all pqt.onnx/pt and qat. pt/onnx models and get the expected mAP values, but I have 0% mAP on engine files after trtexec onnx2trt conversion (I use trtexec --int8 --fp16 --minShapes=images: 1x3x640x640 --maxShapes=images:1x3x640x640 --optShapes=images:1x3x640x640 --shapes=images:1x3x640x640 --onnx=yolov5_trimmed_qat. onnx --saveEngine=qat.engine) I'm working inside the NGC container image nvcr.io/nvidia/pytorch:23.04-py3 using a GPU RTX 3090, can I use or adapt the export code on a generic NVIDIA GPU or does it only work on Jetson devices? Thanks

olibartfast commented 7 months ago

The problem was that the exported qat/ptq.onnx model had four outputs; to test it, I ran the original val.py script from the yolov5 repository, which only considers one output. To solve this, I customised the script to select the correct output layer for the post-processing step. Screenshot from 2024-03-06 15-12-52