Setup step (change .env paths or set relative dataset path in cloud environment)
- Find head structure & data augmentation strategy
- Train (unfreeze head and/or last block)
- Find ranges of weights, bias & activation (Visualize optionally)
- PTQ (3 methods) & Evaluate
- Create hwa_wt_range_search.ipynb
- .env should be added with the following paths in the root directory:
BASE_PATH, PATH_DATASET, PATH_TEST, PATH_RAWDATA, PATH_JOINEDDATA, PATH_SAVEDMODELS
The folder structure presented below should be followed.
- This project goes hand to hand with ml_project_util . This package is installed as below.
# In cloud engines/environments
!pip install git+https://github.com/aris-gk3/ml_project_util.git
# In local environments
pip install git+https://github.com/aris-gk3/ml_project_util.git
- Dataset & Test Split
Add images in classes - Apply Transfer Learning to VGG-16
a. Set new head freeze other layers and train
b. If needed, unfreeze some more layers & train - Apply PTQ and evaluate
Code iteratively finds appropriate ranges for quantization. Calculations are made for HW efficient quantization. In this, multiply and add operations for scaling between layers is substituted with bit shifting by adjusting the ranges of each layer.
In both Tran_val & Test directories, images are contained in 1 subdirectory per class.
VGG-16 takes as input 224x224x3, where 3 stands for BGR.
Choose appropriate Data Augmentation strategy.
Add example code