quantizeation code
modules_to_fuse = [['conv1.0', 'conv1.1', 'conv1.2'],
                   ['conv1.3', 'conv1.4', 'conv1.5'],
                   ['layer1.0.conv1', 'layer1.0.bn1'],
                   ['layer1.0.conv2', 'layer1.0.bn2'],
                   ['layer1.1.conv1', 'layer1.1.bn1'],
                   ['layer1.1.conv2', 'layer1.1.bn2'],
                   ['layer2.0.conv1', 'layer2.0.bn1'],
                   ['layer2.0.conv2', 'layer2.0.bn2'],
                   ['layer2.0.downsample.0', 'layer2.0.downsample.1'],
                   ['layer2.1.conv1', 'layer2.1.bn1'],
                   ['layer2.1.conv2', 'layer2.1.bn2'],
                   ['layer3.0.conv1', 'layer3.0.bn1'],
                   ['layer3.0.conv2', 'layer3.0.bn2'],
                   ['layer3.0.downsample.0', 'layer3.0.downsample.1'],
                   ['layer3.1.conv1', 'layer3.1.bn1'],
                   ['layer3.1.conv2', 'layer3.1.bn2'],
                   ['layer4.0.conv1', 'layer4.0.bn1'],
                   ['layer4.0.conv2', 'layer4.0.bn2'],
                   ['layer4.0.downsample.0', 'layer4.0.downsample.1'],
                   ['layer4.1.conv1', 'layer4.1.bn1'],
                   ['layer4.1.conv2', 'layer4.1.bn2'],
                   ['layer5.0.conv1', 'layer5.0.bn1'],
                   ['layer5.0.conv2', 'layer5.0.bn2'],
                   ['layer5.0.conv3', 'layer5.0.bn3'],
                   ['layer5.0.downsample.0', 'layer5.0.downsample.1'],
                   ['layer3_.0.conv1', 'layer3_.0.bn1'],
                   ['layer3_.0.conv2', 'layer3_.0.bn2'],
                   ['layer3_.1.conv1', 'layer3_.1.bn1'],
                   ['layer3_.1.conv2', 'layer3_.1.bn2'],
                   ['layer4_.0.conv1', 'layer4_.0.bn1'],
                   ['layer4_.0.conv2', 'layer4_.0.bn2'],
                   ['layer4_.1.conv1', 'layer4_.1.bn1'],
                   ['layer4_.1.conv2', 'layer4_.1.bn2'],
                   ['layer5_.0.conv1', 'layer5_.0.bn1'],
                   ['layer5_.0.conv2', 'layer5_.0.bn2'],
                   ['layer5_.0.conv3', 'layer5_.0.bn3'],
                   ['layer5_.0.downsample.0', 'layer5_.0.downsample.1'],
                   ['compression3.0', 'compression3.1'],
                   ['compression4.0', 'compression4.1'],
                   ['down3.0', 'down3.1'],
                   ['down4.0', 'down4.1', 'down4.2'],
                   ['down4.3', 'down4.4'],
                   ['spp.scale1.1', 'spp.scale1.2'],
                   ['spp.scale2.1', 'spp.scale2.2'],
                   ['spp.scale3.1', 'spp.scale3.2'],
                   ['spp.scale4.1', 'spp.scale4.2'],
                   ['spp.scale0.0', 'spp.scale0.1'],
                   ['spp.process1.0', 'spp.process1.1'],
                   ['spp.process2.0', 'spp.process2.1'],
                   ['spp.process3.0', 'spp.process3.1'],
                   ['spp.process4.0', 'spp.process4.1'],
                   ['spp.compression.0', 'spp.compression.1'],
                   ['spp.shortcut.0', 'spp.shortcut.1'],
                   ['seghead_extra.conv1', 'seghead_extra.bn2'],
                   ['final_layer.conv1', 'final_layer.bn2']
                  ]

fused_model = torch.quantization.fuse_modules(model, modules_to_fuse2, inplace=False)

fused_model.qconfig = torch.quantization.get_default_qconfig('fbgemm')
model_prepared = torch.quantization.prepare(fused_model)

# Calibrate
# ...

quantized_model = torch.quantization.convert(model_prepared)