I had a YOLOv11 object detection model. I took the yolo11n.pt model and converted it to ONNX format. After that, I simplified the ONNX model using onnxsim. Then, using onnx2tf, I converted the model to the SavedModel (.pb) format. Subsequently, using NXP's eIQ Toolkit, I converted this .pb model to an INT8 quantized model. For this, I used the COCO128 dataset (100+ images) as the calibration dataset.
The model was successfully converted, but it does not detect any objects, whereas the INT8 model obtained using the Ultralytics export API produces correct detections. When I checked the internal weights of both models, they were different, and the model outputs for the same image also differed significantly.
Please help me convert the .pb model correctly so that detections happen as expected.
Hi swapnildaphal:
The INT8 model obtained by the yolo official Ultralytics export API also calls the onnx2tf API internally. It should be the same as the method you mentioned: yolo11n.pt -> yolo11.onnx -> yolo11_sim.onnx -> yolo11 tensorflow saved model -> tftlie int8 model.
For EIQ toolkit, the .pb model is converted to int8quantized, which also encapsulates the quantization code of tflite. So after getting the tensorflow saved model, you can use the following code to perform quantization tests. It should be noted that the preprocessing method of the specified model should be consistent with the original preprocessing method during quantization.
So you can generate tensorflow saved moel through the conversion API of ultralytics, and then call the official quantization tool of tflite to quantize the model.
Regards
Daniel