1 # Quantization
3 ## =====================================================================================
4 ## Post Training Calibration & Quantization - this will write out a quantization friendly model very quickly
5 ## =====================================================================================
6 #
7 #### Image Classification - Post Training Calibration & Quantization - ResNet50
8 #python ./scripts/train_classification_main.py --phase calibration --dataset_name image_folder_classification --model_name resnet50_x1 --data_path ./data/datasets/image_folder_classification \
9 #--pretrained https://download.pytorch.org/models/resnet50-19c8e357.pth \
10 #--batch_size 64 --quantize True --epochs 1 --epoch_size 100
11 #
12 #
13 #### Image Classification - Post Training Calibration & Quantization - MobileNetV2
14 #python ./scripts/train_classification_main.py --phase calibration --dataset_name image_folder_classification --model_name mobilenetv2_tv_x1 --data_path ./data/datasets/image_folder_classification \
15 #--pretrained https://download.pytorch.org/models/mobilenet_v2-b0353104.pth \
16 #--batch_size 64 --quantize True --epochs 1 --epoch_size 100
17 #
18 #
19 #### Image Classification - Post Training Calibration & Quantization for a TOUGH MobileNetV2 pretrained model
20 #python ./scripts/train_classification_main.py --phase calibration --dataset_name image_folder_classification --model_name mobilenetv2_shicai_x1 --data_path ./data/datasets/image_folder_classification \
21 #--pretrained ./data/modelzoo/pretrained/pytorch/others/shicai/MobileNet-Caffe/mobilenetv2_shicai_rgb.tar \
22 #--batch_size 64 --quantize True --epochs 1 --epoch_size 100
23 #
24 #
25 #### Semantic Segmentation - Post Training Calibration & Quantization for MobileNetV2+DeeplabV3Lite
26 #python ./scripts/train_segmentation_main.py --phase calibration --dataset_name cityscapes_segmentation --model_name deeplabv3lite_mobilenetv2_tv --data_path ./data/datasets/cityscapes/data --img_resize 384 768 --output_size 1024 2048 --gpus 0 1 \
27 #--pretrained ./data/modelzoo/semantic_segmentation/cityscapes/deeplabv3lite-mobilenetv2/cityscapes_segmentation_deeplabv3lite-mobilenetv2_2019-06-26-08-59-32.pth \
28 #--batch_size 12 --quantize True --epochs 1 --epoch_size 100
29 #
30 #
31 ## =====================================================================================
32 ## Trained Quantization - If And Only if Post Training Calibration and Quantization (above) doesn't work
33 ## =====================================================================================
34 #
35 #### Image Classification - Trained Quantization - MobileNetV2
36 #python ./scripts/train_classification_main.py --dataset_name image_folder_classification --model_name mobilenetv2_tv_x1 --data_path ./data/datasets/image_folder_classification \
37 #--pretrained https://download.pytorch.org/models/mobilenet_v2-b0353104.pth \
38 #--batch_size 64 --quantize True --epochs 25 --epoch_size 1000 --lr 5e-5 --evaluate_start False
39 #
40 #
41 #### Image Classification - Trained Quantization - MobileNetV2(Shicai) - a TOUGH MobileNetV2 pretrained model
42 #python ./scripts/train_classification_main.py --dataset_name image_folder_classification --model_name mobilenetv2_shicai_x1 --data_path ./data/datasets/image_folder_classification \
43 #--pretrained ./data/modelzoo/pretrained/pytorch/others/shicai/MobileNet-Caffe/mobilenetv2_shicai_rgb.tar \
44 #--batch_size 64 --quantize True --epochs 25 --epoch_size 1000 --lr 5e-5 --evaluate_start False
45 #
46 #
47 #### Semantic Segmentation - Trained Quantization for MobileNetV2+DeeplabV3Lite
48 #python ./scripts/train_segmentation_main.py --dataset_name cityscapes_segmentation --model_name deeplabv3lite_mobilenetv2_tv --data_path ./data/datasets/cityscapes/data --img_resize 384 768 --output_size 1024 2048 --gpus 0 1 \
49 #--pretrained ./data/modelzoo/semantic_segmentation/cityscapes/deeplabv3lite-mobilenetv2/cityscapes_segmentation_deeplabv3lite-mobilenetv2_2019-06-26-08-59-32.pth \
50 #--batch_size 12 --quantize True --epochs 150 --lr 5e-5 --evaluate_start False
52 ## =====================================================================================
53 ## Acuracy Evaluation with Post Training Quantization - cannot save quantized model - only accuracy evaluation
54 ## =====================================================================================
56 #### Image Classification - Accuracy Estimation with Post Training Quantization - MobileNetV2
57 #python ./scripts/train_classification_main.py --phase validation --dataset_name image_folder_classification --model_name mobilenetv2_tv_x1 --data_path ./data/datasets/image_folder_classification \
58 #--pretrained https://download.pytorch.org/models/mobilenet_v2-b0353104.pth \
59 #--batch_size 64 --quantize True
61 #### Image Classification - Accuracy Estimation with Post Training Quantization - ResNet50
62 #python ./scripts/train_classification_main.py --phase validation --dataset_name image_folder_classification --model_name resnet50_x1 --data_path ./data/datasets/image_folder_classification \
63 #--pretrained https://download.pytorch.org/models/resnet50-19c8e357.pth \
64 #--batch_size 64 --quantize True
66 #### Image Classification - Accuracy Estimation with Post Training Quantization - A TOUGH MobileNetV2 pretrained model
67 #python ./scripts/train_classification_main.py --phase validation --dataset_name image_folder_classification --model_name mobilenetv2_shicai_x1 --data_path ./data/datasets/image_folder_classification \
68 #--pretrained ./data/modelzoo/pretrained/pytorch/others/shicai/MobileNet-Caffe/mobilenetv2_shicai_rgb.tar \
69 #--batch_size 64 --quantize True
71 #### Semantic Segmentation - Accuracy Estimation with Post Training Quantization
72 #python ./scripts/train_segmentation_main.py --phase validation --dataset_name cityscapes_segmentation --model_name deeplabv3lite_mobilenetv2_tv --data_path ./data/datasets/cityscapes/data --img_resize 384 768 --output_size 1024 2048 --gpus 0 1 \
73 #--pretrained './data/modelzoo/semantic_segmentation/cityscapes/deeplabv3lite-mobilenetv2/cityscapes_segmentation_deeplabv3lite-mobilenetv2_2019-06-26-08-59-32.pth' \
74 #--batch_size 1 --quantize True