]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - jacinto-ai/pytorch-jacinto-ai-devkit.git/blob - run_quantization.sh
constrain_bias_start_iter - reverting to the correct value
[jacinto-ai/pytorch-jacinto-ai-devkit.git] / run_quantization.sh
1 ## Quantization
2 #
3 ## =====================================================================================
4 ## Post Training Calibration & Quantization - this is fast, but may not always yield best quantized accuracy (not recommended)
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 \
9 #--data_path ./data/datasets/image_folder_classification --gpus 0 \
10 #--pretrained https://download.pytorch.org/models/resnet50-19c8e357.pth \
11 #--batch_size 64 --quantize True --epochs 1 --epoch_size 0.1 --evaluate_start False
12 #
13 #
14 #### Image Classification - Post Training Calibration & Quantization - ResNet18
15 #python ./scripts/train_classification_main.py --phase calibration --dataset_name image_folder_classification --model_name resnet18_x1 \
16 #--data_path ./data/datasets/image_folder_classification --gpus 0 \
17 #--pretrained https://download.pytorch.org/models/resnet18-5c106cde.pth \
18 #--batch_size 64 --quantize True --epochs 1 --epoch_size 0.1 --evaluate_start False
19 #
20 #
21 #### Image Classification - Post Training Calibration & Quantization - MobileNetV2
22 #python ./scripts/train_classification_main.py --phase calibration --dataset_name image_folder_classification --model_name mobilenetv2_tv_x1 \
23 #--data_path ./data/datasets/image_folder_classification --gpus 0 \
24 #--pretrained https://download.pytorch.org/models/mobilenet_v2-b0353104.pth \
25 #--batch_size 64 --quantize True --epochs 1 --epoch_size 0.1 --evaluate_start False
26 #
27 #
28 #### Image Classification - Post Training Calibration & Quantization for a TOUGH MobileNetV2 pretrained model
29 #python ./scripts/train_classification_main.py --phase calibration --dataset_name image_folder_classification --model_name mobilenetv2_shicai_x1 \
30 #--data_path ./data/datasets/image_folder_classification --gpus 0 \
31 #--pretrained ./data/modelzoo/pytorch/image_classification/imagenet1k/shicai/mobilenetv2_shicai_rgb.pth \
32 #--batch_size 64 --quantize True --epochs 1 --epoch_size 0.1 --evaluate_start False
33 #
34 #
35 ### Semantic Segmentation - Post Training Calibration &  Quantization for MobileNetV2+DeeplabV3Lite
36 #python ./scripts/train_segmentation_main.py --phase calibration --dataset_name cityscapes_segmentation --model_name deeplabv3lite_mobilenetv2_tv \
37 #--data_path ./data/datasets/cityscapes/data --img_resize 384 768 --output_size 1024 2048 --gpus 0 \
38 #--pretrained ./data/modelzoo/pytorch/semantic_seg/cityscapes/jacinto_ai/deeplabv3lite_mobilenetv2_tv_768x384_best.pth \
39 #--batch_size 6 --quantize True --epochs 1 --evaluate_start False
40 #
41 #
42 ### Semantic Segmentation - Post Training Calibration &  Quantization for MobileNetV2+UNetLite
43 #python ./scripts/train_segmentation_main.py --phase calibration --dataset_name cityscapes_segmentation --model_name unetlite_pixel2pixel_aspp_mobilenetv2_tv \
44 #--data_path ./data/datasets/cityscapes/data --img_resize 384 768 --output_size 1024 2048 --gpus 0 \
45 #--pretrained ./data/modelzoo/pytorch/semantic_seg/cityscapes/jacinto_ai/unet_aspp_mobilenetv2_tv_768x384_best.pth \
46 #--batch_size 6 --quantize True --epochs 1 --evaluate_start False
47 #
48 #
49 ### Depth Estimation - Post Training Calibration &  Quantization for MobileNetV2+DeeplabV3Lite
50 #python ./scripts/train_depth_main.py --phase calibration --dataset_name kitti_depth --model_name deeplabv3lite_mobilenetv2_tv  --gpus 0 \
51 #--pretrained ./data/modelzoo/pytorch/monocular_depth/kitti_depth/jacinto_ai/deeplabv3lite_mobilenetv2_tv_768x384_best.pth \
52 #--batch_size 32 --quantize True --epochs 1 --evaluate_start False
53 #
54 #
55 ## =====================================================================================
56 ## Quantization Aware Training
57 ## =====================================================================================
58 #
59 #### Image Classification - Quantization Aware Training - MobileNetV2
60 #python ./scripts/train_classification_main.py --dataset_name image_folder_classification --model_name mobilenetv2_tv_x1 \
61 #--data_path ./data/datasets/image_folder_classification \
62 #--pretrained https://download.pytorch.org/models/mobilenet_v2-b0353104.pth \
63 #--batch_size 64 --quantize True --epoch_size 0.1 --epochs 50 --lr 1e-5 --evaluate_start False
64 #
65 #
66 #### Image Classification - Quantization Aware Training - MobileNetV2(Shicai) - a TOUGH MobileNetV2 pretrained model
67 #python ./scripts/train_classification_main.py --dataset_name image_folder_classification --model_name mobilenetv2_shicai_x1 \
68 #--data_path ./data/datasets/image_folder_classification \
69 #--pretrained ./data/modelzoo/pytorch/image_classification/imagenet1k/shicai/mobilenetv2_shicai_rgb.pth \
70 #--batch_size 64 --quantize True --epoch_size 0.1 --epochs 50 --lr 1e-5 --evaluate_start False
71 #
72 #
73 #### Semantic Segmentation - Quantization Aware Training for MobileNetV2+DeeplabV3Lite
74 #python ./scripts/train_segmentation_main.py --dataset_name cityscapes_segmentation --model_name deeplabv3lite_mobilenetv2_tv \
75 #--data_path ./data/datasets/cityscapes/data --img_resize 384 768 --output_size 1024 2048 --gpus 0 1 \
76 #--pretrained ./data/modelzoo/pytorch/semantic_seg/cityscapes/jacinto_ai/deeplabv3lite_mobilenetv2_tv_768x384_best.pth \
77 #--batch_size 12 --quantize True --epochs 50  --lr 1e-5 --evaluate_start False
78 #
79 #
80 #### Semantic Segmentation - Quantization Aware Training for MobileNetV2+UNetLite
81 #python ./scripts/train_segmentation_main.py --dataset_name cityscapes_segmentation --model_name unetlite_pixel2pixel_aspp_mobilenetv2_tv \
82 #--data_path ./data/datasets/cityscapes/data --img_resize 384 768 --output_size 1024 2048 --gpus 0 1 \
83 #--pretrained ./data/modelzoo/pytorch/semantic_seg/cityscapes/jacinto_ai/unet_aspp_mobilenetv2_tv_768x384_best.pth \
84 #--batch_size 12 --quantize True --epochs 50 --lr 1e-5 --evaluate_start False
85 #
86 #
87 ### Depth Estimation - Quantization Aware Training for MobileNetV2+DeeplabV3Lite
88 #python ./scripts/train_depth_main.py --dataset_name kitti_depth --model_name deeplabv3lite_mobilenetv2_tv --img_resize 384 768 --output_size 1024 2048 \
89 #--pretrained ./data/modelzoo/pytorch/monocular_depth/kitti_depth/jacinto_ai/deeplabv3lite_mobilenetv2_tv_768x384_best.pth \
90 #--batch_size 32 --quantize True --epochs 50 --lr 1e-5 --evaluate_start False
91 #
92 #
93 ## =====================================================================================
94 ## Acuracy Evaluation with Post Training Quantization - this is not supported anymore.
95 ## Either Calibration or QAT has to be performed first, to get correct accuracy.
96 ## Please use one of the sections above.
97 ## =====================================================================================
98 #
99 #### Image Classification - Accuracy Estimation with Post Training Quantization - MobileNetV2
100 #python ./scripts/train_classification_main.py --phase validation --dataset_name image_folder_classification --model_name mobilenetv2_tv_x1 \
101 #--data_path ./data/datasets/image_folder_classification \
102 #--pretrained https://download.pytorch.org/models/mobilenet_v2-b0353104.pth \
103 #--batch_size 64 --quantize True
105 #### Image Classification - Accuracy Estimation with Post Training Quantization - ResNet50
106 #python ./scripts/train_classification_main.py --phase validation --dataset_name image_folder_classification --model_name resnet50_x1 \
107 #--data_path ./data/datasets/image_folder_classification \
108 #--pretrained https://download.pytorch.org/models/resnet50-19c8e357.pth \
109 #--batch_size 64 --quantize True
111 #### Image Classification - Accuracy Estimation with Post Training Quantization - ResNet18
112 #python ./scripts/train_classification_main.py --phase validation --dataset_name image_folder_classification --model_name resnet18_x1 \
113 #--data_path ./data/datasets/image_folder_classification \
114 #--pretrained https://download.pytorch.org/models/resnet18-5c106cde.pth \
115 #--batch_size 64 --quantize True
117 #### Image Classification - Accuracy Estimation with Post Training Quantization - A TOUGH MobileNetV2 pretrained model
118 #python ./scripts/train_classification_main.py --phase validation --dataset_name image_folder_classification --model_name mobilenetv2_shicai_x1 \
119 #--data_path ./data/datasets/image_folder_classification \
120 #--pretrained ./data/modelzoo/pytorch/image_classification/imagenet1k/shicai/mobilenetv2_shicai_rgb.pth \
121 #--batch_size 64 --quantize True
123 #### Semantic Segmentation - Accuracy Estimation with Post Training Quantization - MobileNetV2+DeeplabV3Lite
124 #python ./scripts/train_segmentation_main.py --phase validation --dataset_name cityscapes_segmentation --model_name deeplabv3lite_mobilenetv2_tv \
125 #--data_path ./data/datasets/cityscapes/data --img_resize 384 768 --output_size 1024 2048 --gpus 0 1 \
126 #--pretrained './data/modelzoo/pytorch/semantic_seg/cityscapes/jacinto_ai/deeplabv3lite_mobilenetv2_tv_768x384_best.pth' \
127 #--batch_size 1 --quantize True
129 #### Semantic Segmentation - Accuracy Estimation with Post Training Quantization - MobileNetV2+UNetLite
130 #python ./scripts/train_segmentation_main.py --phase validation --dataset_name cityscapes_segmentation --model_name unetlite_pixel2pixel_aspp_mobilenetv2_tv \
131 #--data_path ./data/datasets/cityscapes/data --img_resize 384 768 --output_size 1024 2048 --gpus 0 1 \
132 #--pretrained ./data/modelzoo/pytorch/semantic_seg/cityscapes/jacinto_ai/unet_aspp_mobilenetv2_tv_768x384_best.pth \
133 #--batch_size 1 --quantize True
136 ## =====================================================================================
137 # Not completely supported feature - ONNX Model Import and PTQ
138 ## =====================================================================================
139 #### Image Classification - Post Training Calibration & Quantization
140 #python ./scripts/train_classification_main.py --phase calibration --dataset_name image_folder_classification --gpus 0 \
141 #--model_name resnet18-v1-7 --model /data/tensorlabdata1/modelzoo/pytorch/image_classification/imagenet1k/onnx-model-zoo/resnet18-v1-7.onnx \
142 #--data_path ./data/datasets/image_folder_classification --batch_size 64 --quantize True --epochs 1 --epoch_size 0.1 --evaluate_start False