This work implements the pruning of resnet50 cat and dog classification model. Pruning tool based on https://github.com/VainF/Torch-Pruning.
numpy torch torchvison matplotlib tqdm mnn
You may need to change your own path in the code.
wget -c https://download.microsoft.com/download/3/E/1/3E1C3F21-ECDB-4869-8368-6DEBA77B919F/kagglecatsanddogs_3367a.zip
Split the dataset into train and test at a ratio of 0.1, both of which contain cat and dog.
cd resnet50_catdog
python train.py --sr False
python train.py --sr True --s 0.0001
python prune.py --percent 0.8 --sr False
python test.py
python pth2onnx.py
mnnconvert [-h] -f {TF,CAFFE,ONNX,TFLITE,MNN} --modelFile MODELFILE
[--prototxt PROTOTXT] --MNNModel MNNMODEL [--fp16 FP16]
Prepare feature quantization image
mnnquant src_mnn dst_mnn config
python mnn_inference.py