0
0
Computer Visionml~10 mins

Mask R-CNN overview in Computer Vision - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to import the Mask R-CNN model from the torchvision library.

Computer Vision
from torchvision.models.detection import [1]
Drag options to blanks, or click blank then click option'
Amaskrcnn_resnet50_fpn
Bfasterrcnn_resnet50_fpn
Cretinanet_resnet50_fpn
Dssd300_vgg16
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing Faster R-CNN import instead of Mask R-CNN.
Confusing RetinaNet or SSD with Mask R-CNN.
2fill in blank
medium

Complete the code to create a Mask R-CNN model pre-trained on COCO dataset.

Computer Vision
model = [1](pretrained=True)
Drag options to blanks, or click blank then click option'
Afasterrcnn_resnet50_fpn
Bssd300_vgg16
Cretinanet_resnet50_fpn
Dmaskrcnn_resnet50_fpn
Attempts:
3 left
💡 Hint
Common Mistakes
Using Faster R-CNN function instead of Mask R-CNN.
Forgetting to set pretrained=True.
3fill in blank
hard

Fix the error in the code to switch the model to evaluation mode.

Computer Vision
model.[1]()
Drag options to blanks, or click blank then click option'
Atrain
Bfit
Ceval
Dpredict
Attempts:
3 left
💡 Hint
Common Mistakes
Using train() instead of eval().
Using non-existing methods like fit() or predict().
4fill in blank
hard

Fill both blanks to prepare the input image tensor and move it to the device.

Computer Vision
image = image.to([1]).unsqueeze([2])
Drag options to blanks, or click blank then click option'
Adevice
B0
C1
Dcpu
Attempts:
3 left
💡 Hint
Common Mistakes
Using unsqueeze(1) instead of unsqueeze(0).
Moving image to cpu explicitly when device is GPU.
5fill in blank
hard

Fill all three blanks to run the model on input and get masks from the output.

Computer Vision
with torch.no_grad():
    output = model([1])
    masks = output[0][[2]].squeeze([3]) > 0.5
Drag options to blanks, or click blank then click option'
A[image]
Bmasks
C1
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Passing image tensor directly instead of a list.
Accessing output with wrong key or index.
Using squeeze(0) instead of squeeze(1).