1. Learn
  2. /
  3. Courses
  4. /
  5. Deep Learning for Images with PyTorch

Connected

Exercise

Overlay instance masks

Good job producing the semantic mask in the previous exercise! Now, you can overwrite it with instance masks in the locations where the objects have been identified by the instance segmentation model.

You will use the pre-trained MaskRCNN available in your workspace to produce instance segmentation masks. Then, you will loop over these masks and for each of them, you will overlay the parts where an object is detected with high certainty on top of the semantic mask.

torch is already imported for you.

Instructions

100 XP
  • Initialize panoptic_mask by cloning the semantic_mask.
  • Define the for-loop to iterate over the instance masks, calling the iterator variable mask.
  • For each instance mask, in location where it is larger than 0.5, overwrite the panoptic mask with the current instance_id.