i.MX95 GoPoint DMS Demo: Graph differences and PTQ process for face_detection_ptq.tflite

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

i.MX95 GoPoint DMS Demo: Graph differences and PTQ process for face_detection_ptq.tflite

158 Views
akashhalli
Contributor I
Hello,
I am currently running the GoPoint Driver Monitoring System (DMS) demo on an i.MX95 evaluation kit using the lf-6.12.49_2.2.0 release.
While examining the source code comments for the face detection model, it notes that the demo utilizes Google's MediaPipe BlazeFace (short-range) model:
  • Original Google Model: face_detection_short_range.tflite (MediaPipe Assets URL)
  • Model Card: BlazeFace Model Card
  • License: Apache-2.0
However, the demo's downloads.json points to an NXP-hosted, quantized variant:
 
The Issue / Discrepancy:
When I load and compare both the original Google MediaPipe TFLite model and NXP's face_detection_ptq.tflite in netron.app, I notice that the model graphs are structurally different. They do not look like a simple 1:1 quantization of the exact same network topology.
I have two questions regarding how NXP prepared this asset for the i.MX95 NPU / eIQ stack:
  1. Graph Discrepancies: Why are the model graphs structurally different in Netron? Did NXP modify the network architecture, strip custom MediaPipe TFLite operations (like custom anchors/detections), or substitute certain layers to optimize compatibility with the i.MX95 NPU / eIQ inference engine?
  2. PTQ Implementation Pipeline: If NXP optimized and converted the original Google model, how was Post-Training Quantization (PTQ) applied? Typically, standard TensorFlow optimization pipelines require the original frozen graph (.pb), saved model format, or floating-point Keras/TF definitions to run calibration datasets. Since Google distributes MediaPipe models directly as .tflite files, did NXP apply PTQ directly onto a floating-point .tflite file (e.g., using the tf.lite.TFLiteConverter.from_saved_model pipeline or eIQ tools), or was the model reconstructed from scratch? 
Any insight into the exact optimization and quantization workflow used for this demo asset would be highly appreciated!
 
Thanks in advance.
 

 
 
0 Kudos
Reply
1 Reply

46 Views
JosephAtNXP
NXP TechSupport
NXP TechSupport

Hi,

Thank you for your interest in NXP Semiconductor products,

1. Models often have unsupported operators and lead to change them with a combination of supported operators. The difference you are observing may be because of supported operators to optimize NPU usage.

https://www.nxp.com/docs/en/user-guide/UG10166.pdf

 2. PTQ can be applied with a quantized TFLite model using eIQ toolkit prior to converting it to Vela or Neutron models.

https://docs.nxp.com/bundle/EIQTUG/page/topics/quantization.html

Regards

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2373010%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3Ei.MX95%20GoPoint%20DMS%20Demo%3A%20Graph%20differences%20and%20PTQ%20process%20for%20face_detection_ptq.tflite%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2373010%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CDIV%20class%3D%22%22%3EHello%2C%3C%2FDIV%3E%3CDIV%20class%3D%22%22%3EI%20am%20currently%20running%20the%20%3CSTRONG%3EGoPoint%20Driver%20Monitoring%20System%20(DMS)%3C%2FSTRONG%3E%20demo%20on%20an%20%3CSTRONG%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fwww.google.com%2Fsearch%3Fibp%3Doshop%26amp%3Bprds%3Dpvt%3Ahg%2Cpvo%3A29%2CimageDocid%3A12247372522650438966%2CheadlineOfferDocid%3A12930004561934444363%2CproductDocid%3A12930004561934444363%26amp%3Bq%3Dproduct%26amp%3Bsa%3DX%26amp%3Bved%3D2ahUKEwi68aDIqt6UAxXhbGwGHdv7JdEQxa4PeggIAggACA0QAg%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ei.MX95%3C%2FA%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSTRONG%3E%20evaluation%20kit%20using%20the%20%3CSTRONG%3Elf-6.12.49_2.2.0%3C%2FSTRONG%3E%20release.%3C%2FDIV%3E%3CDIV%20class%3D%22%22%3EWhile%20examining%20the%20source%20code%20comments%20for%20the%20face%20detection%20model%2C%20it%20notes%20that%20the%20demo%20utilizes%20Google's%20MediaPipe%20BlazeFace%20(short-range)%20model%3A%3C%2FDIV%3E%3CUL%3E%3CLI%3E%3CSPAN%20class%3D%22%22%3E%3CSTRONG%3EOriginal%20Google%20Model%3A%3C%2FSTRONG%3E%20face_detection_short_range.tflite%20(MediaPipe%20Assets%20URL)%3C%2FSPAN%3E%3C%2FLI%3E%3CLI%3E%3CSPAN%20class%3D%22%22%3E%3CSTRONG%3EModel%20Card%3A%3C%2FSTRONG%3E%20BlazeFace%20Model%20Card%3C%2FSPAN%3E%3C%2FLI%3E%3CLI%3E%3CSPAN%20class%3D%22%22%3E%3CSTRONG%3ELicense%3A%3C%2FSTRONG%3E%20Apache-2.0%3C%2FSPAN%3E%3C%2FLI%3E%3C%2FUL%3E%3CDIV%20class%3D%22%22%3EHowever%2C%20the%20demo's%20downloads.json%20points%20to%20an%20NXP-hosted%2C%20quantized%20variant%3A%3C%2FDIV%3E%3CUL%3E%3CLI%3E%3CSPAN%20class%3D%22%22%3E%3CSTRONG%3ENXP%20Asset%20URL%3A%3C%2FSTRONG%3E%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fnxp-imx-support%2Fnxp-demo-experience-assets%2Fraw%2Flf-6.12.49_2.2.0%2Fmodels%2Fface_detection_ptq.tflite%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Fgithub.com%2Fnxp-imx-support%2Fnxp-demo-experience-assets%2Fraw%2Flf-6.12.49_2.2.0%2Fmodels%2Fface_detection_ptq.tflite%3C%2FA%3E%3C%2FSPAN%3E%3C%2FLI%3E%3C%2FUL%3E%3CDIV%20class%3D%22%22%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%20class%3D%22%22%3EThe%20Issue%20%2F%20Discrepancy%3A%3C%2FDIV%3E%3CDIV%20class%3D%22%22%3EWhen%20I%20load%20and%20compare%20both%20the%20original%20Google%20MediaPipe%20TFLite%20model%20and%20NXP's%20face_detection_ptq.tflite%20in%20%3CSTRONG%3En%3C%2FSTRONG%3E%3CSTRONG%3Eetron.app%3C%2FSTRONG%3E%2C%20I%20notice%20that%20%3CSTRONG%3Ethe%20model%20graphs%20are%20structurally%20different%3C%2FSTRONG%3E.%20They%20do%20not%20look%20like%20a%20simple%201%3A1%20quantization%20of%20the%20exact%20same%20network%20topology.%3C%2FDIV%3E%3CDIV%20class%3D%22%22%3EI%20have%20two%20questions%20regarding%20how%20NXP%20prepared%20this%20asset%20for%20the%20i.MX95%20NPU%20%2F%20eIQ%20stack%3A%3C%2FDIV%3E%3COL%3E%3CLI%3E%3CSPAN%20class%3D%22%22%3E%3CSTRONG%3EGraph%20Discrepancies%3A%3C%2FSTRONG%3E%20Why%20are%20the%20model%20graphs%20structurally%20different%20in%20Netron%3F%20Did%20NXP%20modify%20the%20network%20architecture%2C%20strip%20custom%20MediaPipe%20TFLite%20operations%20(like%20custom%20anchors%2Fdetections)%2C%20or%20substitute%20certain%20layers%20to%20optimize%20compatibility%20with%20the%20i.MX95%20NPU%20%2F%20eIQ%20inference%20engine%3F%3C%2FSPAN%3E%3C%2FLI%3E%3CLI%3E%3CSPAN%20class%3D%22%22%3E%3CSTRONG%3EPTQ%20Implementation%20Pipeline%3A%3C%2FSTRONG%3E%20If%20NXP%20optimized%20and%20converted%20the%20original%20Google%20model%2C%20how%20was%20%3CSTRONG%3EPost-Training%20Quantization%20(PTQ)%3C%2FSTRONG%3E%20applied%3F%20Typically%2C%20standard%20TensorFlow%20optimization%20pipelines%20require%20the%20original%20frozen%20graph%20(.pb)%2C%20saved%20model%20format%2C%20or%20floating-point%20Keras%2FTF%20definitions%20to%20run%20calibration%20datasets.%20Since%20Google%20distributes%20MediaPipe%20models%20directly%20as%20.tflite%20files%2C%20did%20NXP%20apply%20PTQ%20directly%20onto%20a%20floating-point%20.tflite%20file%20(e.g.%2C%20using%20the%20tf.lite.TFLiteConverter.from_saved_model%20pipeline%20or%20eIQ%20tools)%2C%20or%20was%20the%20model%20reconstructed%20from%20scratch%3F%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FLI%3E%3C%2FOL%3E%3CDIV%20class%3D%22%22%3EAny%20insight%20into%20the%20exact%20optimization%20and%20quantization%20workflow%20used%20for%20this%20demo%20asset%20would%20be%20highly%20appreciated!%3C%2FDIV%3E%3CDIV%20class%3D%22%22%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%20class%3D%22%22%3EThanks%20in%20advance.%3C%2FDIV%3E%3CDIV%20class%3D%22%22%3E%26nbsp%3B%3C%2FDIV%3E%3CHR%20%2F%3E%3CDIV%20class%3D%22%22%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%20class%3D%22%22%3E%26nbsp%3B%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2374546%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20i.MX95%20GoPoint%20DMS%20Demo%3A%20Graph%20differences%20and%20PTQ%20process%20for%20face_detection_ptq.tflite%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2374546%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%2C%3C%2FP%3E%0A%3CP%3EThank%20you%20for%20your%20interest%20in%20NXP%20Semiconductor%20products%2C%3C%2FP%3E%0A%3CP%3E1.%20Models%20often%20have%20unsupported%20operators%20and%20lead%20to%20change%20them%20with%20a%20combination%20of%26nbsp%3Bsupported%20operators.%20The%20difference%20you%20are%20observing%20may%20be%20because%20of%20supported%20operators%20to%20optimize%20NPU%20usage.%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fwww.nxp.com%2Fdocs%2Fen%2Fuser-guide%2FUG10166.pdf%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.nxp.com%2Fdocs%2Fen%2Fuser-guide%2FUG10166.pdf%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B2.%20PTQ%20can%20be%20applied%20with%20a%20quantized%20TFLite%20model%20using%20eIQ%20toolkit%20prior%20to%20converting%20it%20to%20Vela%20or%20Neutron%20models.%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.nxp.com%2Fbundle%2FEIQTUG%2Fpage%2Ftopics%2Fquantization.html%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.nxp.com%2Fbundle%2FEIQTUG%2Fpage%2Ftopics%2Fquantization.html%3C%2FA%3E%3C%2FP%3E%0A%3CP%3ERegards%3C%2FP%3E%3C%2FLINGO-BODY%3E