Search before asking
#1024 discusses export formats broadly but does not track this problem.
Bug
RF-DETR’s TFLite documentation says INT8 export requires representative calibration images for good accuracy. Export also warns that omitting calibration_data will produce poor quantization accuracy.
RF-DETR does not use calibration for INT8 export. quantization="int8" produces a dynamic-range model with INT8 weights and floating-point activations.
Actual behavior:
model.export(
format="tflite",
quantization="int8",
calibration_data=None,
)
Export succeeds and produces a *_dynamic_range_quant.tflite artifact, but logs:
No calibration_data provided for INT8 quantization. Using random data — this will produce poor quantization accuracy.
That warning is incorrect. _quantize_dynamic_range() sets only:
converter.optimizations = [tf.lite.Optimize.DEFAULT]
It never sets converter.representative_dataset. RF-DETR also never passes output_integer_quantized_tflite to onnx2tf, so calibration data cannot affect the generated INT8 model.
I also checked every currently supported onnx2tf release (2.4.0–2.4.3). None defines the download_test_image_data() function that _patch_validation_download() tries to patch, so supplied calibration_data does not currently reach onnx2tf validation either.
Expected behavior:
- Do not warn when
calibration_data is omitted.
- Document
"int8" as dynamic-range quantization that needs no calibration data.
- Describe
calibration_data and max_images according to their current behavior.
- Keep static/full-integer INT8 unsupported.
Environment
- RF-DETR 1.9.3
develop at 50f21220
- Python 3.12
onnx2tf 2.4.3
Minimal Reproducible Example
from rfdetr import RFDETRSmall
model = RFDETRSmall()
model.export(
format="tflite",
quantization="int8",
calibration_data=None,
)
Are you willing to submit a PR?
Search before asking
#1024 discusses export formats broadly but does not track this problem.
Bug
RF-DETR’s TFLite documentation says INT8 export requires representative calibration images for good accuracy. Export also warns that omitting
calibration_datawill produce poor quantization accuracy.RF-DETR does not use calibration for INT8 export.
quantization="int8"produces a dynamic-range model with INT8 weights and floating-point activations.Actual behavior:
Export succeeds and produces a
*_dynamic_range_quant.tfliteartifact, but logs:That warning is incorrect.
_quantize_dynamic_range()sets only:It never sets
converter.representative_dataset. RF-DETR also never passesoutput_integer_quantized_tflitetoonnx2tf, so calibration data cannot affect the generated INT8 model.I also checked every currently supported
onnx2tfrelease (2.4.0–2.4.3). None defines thedownload_test_image_data()function that_patch_validation_download()tries to patch, so suppliedcalibration_datadoes not currently reachonnx2tfvalidation either.Expected behavior:
calibration_datais omitted."int8"as dynamic-range quantization that needs no calibration data.calibration_dataandmax_imagesaccording to their current behavior.Environment
developat50f21220onnx2tf2.4.3Minimal Reproducible Example
Are you willing to submit a PR?