-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
code for visualization in the object detection tutorial #1610
Comments
Hi, The code I used for the masks uses OpenCV (which torchvision doesn't use as a dependency), and that's one of the reasons why I didn't share that code yet. Here are the scripts: https://gist.github.com/fmassa/d802c684512bcc99f54b714f10c96872 I used something like the following to visualize model = torchvision.models.detection.keypointrcnn_resnet50_fpn(pretrained=True)
model.cuda()
model.eval();
# img is a PIL Image
result, output, top_pred = predict(img, model)
plt.imshow(Image.fromarray(result[:, :, [2, 1, 0]])) Let me know if you have questions. I think it makes sense to add those functions somewhere in torchvision, but I'm not yet sure where |
@fmassa , since you used a pretrained model, didn't you need to normalize your PIL image before? |
Hi @mattans Normalization for the detection models happen inside the model, see
|
Great, thanks. |
At the end of the object detection tutorial it visualizes the masks.
can you please provide the code for that task? or guide how to do it?
The text was updated successfully, but these errors were encountered: