From aa15fec27f744550e5fcfadf563bb678885c41b1 Mon Sep 17 00:00:00 2001 From: Haixin Liu Date: Thu, 31 Oct 2019 11:18:15 -0700 Subject: [PATCH] Add commands to run quantized model with pretrained weights --- references/classification/README.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/references/classification/README.md b/references/classification/README.md index 8b37b8ff2a4..acc2b0b4ed0 100644 --- a/references/classification/README.md +++ b/references/classification/README.md @@ -67,3 +67,24 @@ For Mobilenet-v2, the model was trained with quantization aware training, the se Training converges at about 10 epochs. For post training quant, device is set to CPU. For training, the device is set to CUDA + +### Command to evaluate quantized models using the pre-trained weights: +For all quantized models except inception_v3: +``` +python references/classification/train_quantization.py --data-path='imagenet_full_size/' \ + --device='cpu' --test-only --backend='fbgemm' --model='' +``` + +For inception_v3, since it expects tensors with a size of N x 3 x 299 x 299, before running above command, +need to change the input size of dataset_test in train.py to: +``` +dataset_test = torchvision.datasets.ImageFolder( + valdir, + transforms.Compose([ + transforms.Resize(342), + transforms.CenterCrop(299), + transforms.ToTensor(), + normalize, + ])) +``` +