This documentation page is also available as an interactive notebook. You can launch the notebook in
Kaggle or Colab, or download it for use with an IDE or local Jupyter installation, by clicking one of the
above links.
Draw bounding boxes on images to visualize object detection results.
Problem
You’ve run object detection on images but need to visualize the
results—see where objects were detected and verify the model’s accuracy.
Solution
What’s in this recipe:
- Run object detection with YOLOX
- Draw bounding boxes on images
- Color-code by object class
You create a pipeline that detects objects and then draws the results on
the original image.
Setup
Connected to Pixeltable database at: postgresql+psycopg://postgres:@/pixeltable?host=/Users/pjlb/.pixeltable/pgdata
Created directory ‘viz_demo’.
<pixeltable.catalog.dir.Dir at 0x138534d00>
Create detection and visualization pipeline
Created table ‘images’.
Added 0 column values with 0 errors.
No rows affected.
Added 0 column values with 0 errors.
No rows affected.
Detect and visualize
Inserting rows into `images`: 0 rows [00:00, ? rows/s]
Inserting rows into `images`: 2 rows [00:00, 236.29 rows/s]
Inserted 2 rows with 0 errors.
2 rows inserted, 8 values computed.
Explanation
Pipeline flow:
Image → YOLOX detection → Bounding boxes + labels → bboxes_draw → Annotated image
Detection output format:
The yolox function returns a dict with:
bboxes - List of [x1, y1, x2, y2] coordinates
labels - List of class names (e.g., “cat”, “dog”)
scores - List of confidence scores (0-1)
YOLOX model options:
See also