Basic Checklist of “immediate suspects”:
- Is the model accurate in
SDK_FP_OPTIMIZED
inference emulation mode?
1 …Otherwise, it’s not a pure quantization issue…- Please make sure to use actual images from calibration set and also apply the postprocessing and inspect final result to validate the SW pipeline running the model within the Hailo block, before the actual HW-targeted compression.
- Common pitfalls: (A) Faulty (duplication/omission) distribution of pre/post processing bocks (e.g., normalization) among implementations - programmatic vs. Hailo-integrated using model-script command. (B) Inconsistency of parsing start/end nodes with the pre/post-processing applied around the Hailo blocks.
- Is the calibration set diverse and representative enough of the use case?
- Common pitfalls: Using a single image, possibly repeated. Using random/single-color or otherwise out-of-domain images
- Is the test methodology used actually indicative of failure?
- The proper test is three-way - compare both original and compressed model outputs to the ground-truth using the task-specific postprocessing and metric. Ideally, using a significant number of images.
- Common pitfalls: (A) Using a single image and visual inspection - good only for the most basic proof-of-principle and detecting catastrophic failures. (B) Two-way test - only comparing the outputs of full-precision and compressed model. This can yield seemingly significant errors even in very good cases.
- Do you use BatchNormalization (BN) after convolution layers?
- BN-less convolutions typically make quantization very challenged because of wide outputs ranges, as you can see in histograms provided by the Layer Analysis Tool.
- Clipping can alleviate the issue but it’s potential is limited. The most recommended course of action is re-train the network with full usage of BatchNorm.
For further information check out DFCguide–>ModelOptimization under HailoDeveloperZone, and specifically the DebuggingAccuracy section.
TODO link to degradation-debugging Webinar (video/presentation)