This repository demonstrates two practical applications of quantization:
- Image Quantization: Reducing color depth of an image.
- Model Quantization: Compressing a TensorFlow model using TFLite for edge deployment.
File | Description |
---|---|
quant_image.py |
Performs image color quantization from 256 to N levels. |
quant_model.py |
Applies post-training quantization to a Keras model. |
requirements.txt |
Required Python packages for running the scripts. |
results/ |
Contains output image from quantization. |
Reduce an image’s color depth (e.g., from 256 to 16 levels per channel) and observe visual tradeoffs.
python quant_image.py
Make sure your_image.jpg is present or modify the script to use another image. 💾 Output quantized_output.png
Use TensorFlow Lite to compress a Keras model for edge devices.
python quant_model.py
Install dependencies:
pip install -r requirements.txt If you're using a virtual environment:
python3 -m venv venv source venv/bin/activate pip install -r requirements.txt
TensorFlow Lite Quantization Matplotlib