Skip to content

how to do a PTQ with Fast R-CNN? #2547

Closed Answered by AlexanderDokuchaev
MinGiSa asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @MinGiSa

Thanks for the detailed report.

Yes, we have a issue with quantization of FasterRCNN in PyTorch Backend.

Shorter reproducer:

import torch
import torchvision
from torchvision.models.detection.faster_rcnn import FasterRCNN_ResNet50_FPN_Weights
import nncf
model = torchvision.models.detection.fasterrcnn_resnet50_fpn(weights=FasterRCNN_ResNet50_FPN_Weights.DEFAULT)
image = torch.rand(1, 3, 600, 1200)
int8_model = nncf.quantize(model, nncf.Dataset([image]))

To get quantized OpenVINO you can convert model to IR and use OpenVINO backend.

from pathlib import Path
import openvino as ov
import torch
import torchvision
from torchvision.models.detection.faster_rcnn import FasterRCNN_ResNe…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@alexsu52
Comment options

@MinGiSa
Comment options

Answer selected by MinGiSa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants