对于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仅提供所有可能的边界框和边界框的最佳类,但如何获得一个边界框所有可能类的置信度得分?
我们将非常感谢您的帮助
目前没有回答
相关问题 更多 >
编程相关推荐