对于 pytorch 中的预训练对象检测模型以及模型预测的每个边界框,如何获得该边界框的 80 个 COCO 类中的每一个的置信度分数?
我已经使用预训练的 fasterRCNN Resnet-50 FPN 模型放置了用于对象检测的代码
img = Image.open(img_path) # Load the image
transform = transforms.Compose([transforms.ToTensor()]) # Defing PyTorch Transform
img = transform(img) # Apply the transform to the image
pred = model([img.cuda()]) # Pass the image to the model
pred_class = [COCO_INSTANCE_CATEGORY_NAMES[i] for i in list(pred[0]['labels'].cpu().numpy())] # Get the Prediction Score
pred_boxes = [[(i[0], i[1]), (i[2], i[3])] for i in list(pred[0]['boxes'].cpu().detach().numpy())] # Bounding boxes
pred_score = list(pred[0]['scores'].cpu().detach().numpy())
pred 仅提供所有可能的边界框和边界框的最佳可能类别,但是如何获得一个边界框的所有可能类别的置信度分数?
任何帮助将不胜感激。