Compare object detection and panoptic segmentation

Understand when to use bounding boxes versus pixel-level masks for image analysis.

Images · Notebook · Updated

Colab runs it in your browser. If it calls a model provider, it asks for that provider's API key in a cell.

What it covers

  • Run object detection to get bounding boxes and labels
  • Run panoptic segmentation to get pixel-level masks
  • Visualize and compare outputs side-by-side

What it uses

Install
terminal
pip install pixeltable torch transformers timm
Pixeltable calls
huggingface.()vision.bboxes_draw()vision.overlay_segmentation()pxt.create_table()insert()add_computed_column()

A look at the code

img-detection-vs-segmentation.ipynb
images.add_computed_column(
detections=detr_for_object_detection(
images.image, model_id='facebook/detr-resnet-50', threshold=0.8
)
)

One cell of the notebook, copied as it is. Open it in Colab for the rest.

Browse all 103