This repository contains code for experimenting with knowledge distillation NN compression technique. It was initially proposed in the article. By now pipelines for data processing and model training are implemented for Imagewoof dataset, but the framework is compatible with other datasets. Each experiment corresponds to one commit in the repository. This way the code for reproducing the results is easily accesible for every experiment. The most significant results are collected in Experiment takeaway section of this README.
datasets.py
- contains code to load data in a pytorch compatible formatmodels.py
- models I use in my experiments and distillation loss from the articletraining.py
- train and evaluation pipelinesexperiments.ipynb
- contains code, hyperparams and graphics for current experimentreport.ipynb
- a detailed explanation of my recent experiments (with visualisation). Can be launched in Google Colab
- Python 3.6.9
- CUDA 10.1
- Nvidia Driver 418.67
- Python packages listed in
requirements.txt
There are two ways of running the code:
-
In Google Colab. To start upload
report.ipynb
file to Colab. -
On local machine. Fulfil requirements and install Python packages:
git clone https://github.com/stdereka/knowledge-distillation.git cd knowledge-distillation pip install -r requirements.txt
Teacher Model | Student Model | Dataset | Alpha | T | Accuracy (Distilled) |
Accuracy (No Teacher) |
Code |
---|---|---|---|---|---|---|---|
resnet101_teacher | resnet18_student2 | Imagewoof | 0.1 | 1.0 | 0.9253 | 0.9262 | link |
2.0 | 0.9284 | ||||||
3.0 | 0.9298 | ||||||
4.0 | 0.9306 | ||||||
5.0 | 0.9303 | ||||||
6.0 | 0.9295 | ||||||
7.0 | 0.9284 | ||||||
8.0 | 0.9284 |