Building YOLOX Detection Apps

Pixeltable YOLOX apps work in two phases:

  1. Define your detection workflow (once)
  2. Use your app (anytime)

About Pixeltable YOLOX

pixeltable-yolox is a lightweight, Apache-licensed object detection library built on PyTorch. It is a fork of the MegVii YOLOX package, modernized for recent versions of Python and refactored for easier use as a Python library. This library is designed for developers seeking a modern, accessible object detection solution for both academic and commercial projects.

Pixeltable YOLOX is still under development, and some features of the original YOLOX have not been ported yet. However, it offers a robust foundation for object detection tasks.

Developed by Pixeltable, Inc., a venture-backed AI infrastructure startup, this library aims to meet the vision community’s need for a lightweight object detection library with an untainted open source license. The Pixeltable team brings decades of collective experience in open source development from companies like Google, Cloudera, Twitter, Amazon, and Airbnb.

1

Install Dependencies

pip install pixeltable pixeltable-yolox

Define Your Detection Workflow

Create table.py:

import PIL
import pixeltable as pxt
from yolox.models import Yolox
from yolox.data.datasets import COCO_CLASSES

t = pxt.create_table('image', {'image': pxt.Image}, if_exists='replace')

@pxt.udf
def detect(image: PIL.Image.Image) -> list[str]:
    model = Yolox.from_pretrained("yolox_s")
    result = model([image])
    coco_labels = [COCO_CLASSES[label] for label in result[0]["labels"]]
    return coco_labels

t.add_computed_column(classification=detect(t.image), if_exists='replace')

Use Your App

Create app.py:

import pixeltable as pxt
from yolox.data.datasets import COCO_CLASSES

# Connect to your tables
images = pxt.get_table("image")

# Insert some images
prefix = 'https://upload.wikimedia.org/wikipedia/commons'
paths = [
    '/1/15/Cat_August_2010-4.jpg',
    '/e/e1/Example_of_a_Dog.jpg',
    '/thumb/b/bf/Bird_Diversity_2013.png/300px-Bird_Diversity_2013.png'
]
images.insert({'image': prefix + p} for p in paths)

# Get detection results
image_results = images.select().collect()

# Process and display detailed results
for idx, result in enumerate(image_results):
    print(f"Image {idx + 1} Detection Results:")
    detections = result['classification']
    for label in detections:
        class_name = label
        print(f"  - Detected: {class_name}")

Advanced Inference with YOLOX

Beyond basic object detection, pixeltable-yolox provides detailed output including bounding boxes, confidence scores, and class labels based on the COCO dataset categories.

Contribute to Pixeltable YOLOX

Join our community and contribute to the development of Pixeltable YOLOX