MIRA — Day 6: Post-Training Quantization and Signal Smoothing
What I Built Today
Today I achieved major optimization milestones, Finally creating the INT8 Quantizatio
Post-Training INT8 Quantization
I implemented src/quantize.py using TensorFlow’s TFLiteConverter. The script center-crops and resizes 100 representative images from the dataset to dynamically calibrate activation ranges, converting the uncompressed Keras model to full 8-bit integer precision.
Compression Summary:
- Keras Full Model: 23.48 MB
- Standard TFLite: 8.49 MB
- Quantized INT8 TFLite: 2.61 MB (9.0x smaller than Keras binary)
Zero-Dependency Live TFLite Inference
I completely created the live webcam inference stream (src/live_inference_tflite.py). By implementing a standard mathematical Softmax and image scaling pipeline in pure NumPy, the script now starts instantly and runs with minimal CPU overhead.
Jitter Reduction via Exponential Moving Average (EMA)
To prevent erratic jumps in presicion so it jumping from 60 to 70 in a second caused by camera focus and exposure changes, I implemented a temporal smoothing filter on the output probabilities:
smoothed_probs = alpha * raw_probs + (1 - alpha) * smoothed_probs
Furture plans
So after thinking about it I found 2 logical problems in my model. FIrst of all the dataset it trained on is still to limited and there is not enough variaton in objects.
Secondly the whole Infracstructer is wrong and at the moment its classifier and not a detecter so Its nor able to detect mutipile objects which is important for the Robot arm its also not able to discern mutipile objects on the same screen. So the next Part will porbally be a long post in which I fix all these bugs and add New featurs
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.