---
title: "Compare object detection and panoptic segmentation"
description: "Understand when to use bounding boxes versus pixel-level masks for image analysis."
url: "https://www.pixeltable.com/notebooks/img-detection-vs-segmentation"
updated: "2026-04-10"
---

# Compare object detection and panoptic segmentation

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

- **Type:** Notebook
- **Group:** Images

## 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:** `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

```python
images.add_computed_column(
    detections=detr_for_object_detection(
        images.image, model_id='facebook/detr-resnet-50', threshold=0.8
    )
)
```

## Open it

- **Open in Colab:** https://colab.research.google.com/github/pixeltable/pixeltable/blob/release/docs/release/howto/cookbooks/images/img-detection-vs-segmentation.ipynb
- **Docs page:** https://docs.pixeltable.com/howto/cookbooks/images/img-detection-vs-segmentation
- **Source on GitHub:** https://github.com/pixeltable/pixeltable/blob/release/docs/release/howto/cookbooks/images/img-detection-vs-segmentation.ipynb
