Home

Awesome

Implementation of Network Slimming

Implementation of "Learning Efficient Convolutional Networks through Network Slimming".

Requirements

Example

Train model

$ python src/train.py model/base.json -p vgg_1 -g 0 --no-valid-data

Prune

$ python src/prune.py model/vgg_1.model model/base.json model/vgg_2_org.model model/vgg_2.json 0.5

Fine tune

$ python src/train.py model/vgg_2.json -g 0 -m model/vgg_2_org.model --lambda-value 0

How to use

Train

$ python src/train.py <structure_path> -g <gpu_id> -m <model_path> -b <batch_size> -p <prefix> --optimizer <optimizer> --epoch <epoch_num> --lr-decay-epoch <lr_decay>

While training the following files are saved.

Parameters:

Example:

$ python src/train.py model/base.json -g 0 -b 64 -p vgg_1 --optimizer sgd --epoch 160 --lr-decay-epoch 80,120

Prune

$ python src/prune.py <src_model_path> <src_structure_path> <dest_model_path> <dest_structure_path> <prune_ratio>

Parameters:

Example:

$ python src/prune.py model/vgg_1.model model/base.json model/vgg_2_org.model model/vgg_2.json 0.5

License

MIT License