Skip to main content

Lightweight, open-source, high-performance Yolo implementation

Project description

YoloX

pixeltable-yolox is a lightweight, Apache-licensed object detection library built on pytorch. It is a fork of the MegVii YOLOX package originally authored by Zheng Ge et al, modernized for recent versions of Python and refactored to be more easily usable as a Python library.

pixeltable-yolox is still a work in progress! Some features of YoloX have not been ported yet.

Usage

Installation

pip install pixeltable-yolox

Inference

import requests
from PIL import Image
from yolox.models import Yolox, YoloxProcessor

url = "https://raw.githubusercontent.com/pixeltable/pixeltable-yolox/main/tests/data/000000000001.jpg"
image = Image.open(requests.get(url, stream=True).raw)

model = Yolox.from_pretrained("yolox_s")
result = model([image])  # Inputs can be PIL images or filenames

This yields the following output:

[{'bboxes': [
   (272.36126708984375, 3.5648040771484375, 640.4871826171875, 223.2653350830078),
   (26.643890380859375, 118.68254089355469, 459.80706787109375, 315.089111328125),
   (259.41485595703125, 152.3223114013672, 295.37054443359375, 230.41783142089844)],
  'scores': [0.9417160943584335, 0.8170979975670818, 0.8095869439224117],
  'labels': [7, 2, 12]}]

The labels are COCO category indices.

from yolox.data.datasets import COCO_CLASSES

COCO_CLASSES[7]
'truck'

Training

First unpack a COCO dataset into ./datasets/COCO:

COCO/
  annotations/
    instances_train2017.json
    instances_val2017.json
  train2017/
    # image files
  val2017/
    # image files

Then on the command line:

yolox train -c yolox-s -d 8 -b 64 --fp16 -o

For help:

yolox train -h

Separate Module/Processor Steps

To separate out the Pytorch module from image pre- and post-processing during inference (as is typical in the Hugging Face transformers API):

module = YoloxModule.from_pretrained("yolox_s")
processor = YoloxProcessor("yolox_s")
tensor = processor([image])
output = module(tensor)
result = processor.postprocess([image], output)

Background

The original YOLOX implementation, while powerful, has been updated only sporadically since 2022 and now faces compatibility issues with current Python environments, dependencies, and platforms like Google Colab. This fork aims to provide a reliable, up-to-date, and easy-to-use version of YOLOX that maintains its Apache license, ensuring it remains accessible for academic and commercial use.

Status

pixeltable-yolox is a work in progress. So far, it contains the following changes to the base YOLOX repo:

  • pip installable with all versions of Python (3.9+)
  • New YoloxProcessor class to simplify inference
  • Refactored CLI for training and evaluation
  • Improved test coverage

The following are planned:

  • CI with regular testing and updates
  • Typed for use with mypy

Scope

Further improvements such as model enhancements, training tooling beyond what already exists, etc., are not planned; our goal is to take the existing feature set and make it more easily usable. However, we are happy to shepherd community contributions in those areas and provide engineering infrastructure such as CI and regular releases. We intend to publish a contributors’ guide once the initial release is available.

Thanks for your interest! For any questions or feedback, please contact us at contact@pixeltable.com.

Who are we and why are we doing this?

Pixeltable, Inc. is a venture-backed AI infrastructure startup. Our core product is pixeltable, a database and orchestration system purpose-built for multimodal AI workloads.

Pixeltable integrates with numerous AI services and open source technologies. In the course of integrating with YOLOX, it became clear that there is a strong need in the vision community for a lightweight object detection library with an untainted open source license. It also became clear that while YOLOX is an excellent foundation, it would benefit greatly from code modernization and more regular updates.

We chose to build upon YOLOX both to simplify our own integration, and also to give something back to the community that will (hopefully) prove useful. The Pixeltable team has decades of collective experience in open source development. Our backgrounds include companies such as Google, Cloudera, Twitter, Amazon, and Airbnb, that have a strong commitment to open source development and collaboration.

Contributing

We welcome contributions from the community! If you're interested in helping maintain and improve pixeltable-yolox, check out the contributors' guide.

In memory of Dr. Jian Sun

Without the guidance of Dr. Jian Sun, YOLOX would not have been released and open sourced to the community. The passing away of Dr. Sun is a huge loss to the Computer Vision field. We add this section here to express our remembrance and condolences to Dr. Sun. It is hoped that every AI practitioner in the world will stick to the belief of "continuous innovation to expand cognitive boundaries, and extraordinary technology to achieve product value" and move forward all the way.

Dr. Jian Sun

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pixeltable_yolox-0.4.2.tar.gz (89.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pixeltable_yolox-0.4.2-py3-none-any.whl (113.6 kB view details)

Uploaded Python 3

File details

Details for the file pixeltable_yolox-0.4.2.tar.gz.

File metadata

  • Download URL: pixeltable_yolox-0.4.2.tar.gz
  • Upload date:
  • Size: 89.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.10.16 Darwin/24.3.0

File hashes

Hashes for pixeltable_yolox-0.4.2.tar.gz
Algorithm Hash digest
SHA256 e67e5643c93bac8f4132198a284533acd15f67b154bc700120b73c69c0d20f7c
MD5 c2d58c4c0dd950675048949a71867fc1
BLAKE2b-256 25d7dfddbe690fd0382a8c3d03f970d60b5069d2ab0669e5c3ccc1543d655324

See more details on using hashes here.

File details

Details for the file pixeltable_yolox-0.4.2-py3-none-any.whl.

File metadata

  • Download URL: pixeltable_yolox-0.4.2-py3-none-any.whl
  • Upload date:
  • Size: 113.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.10.16 Darwin/24.3.0

File hashes

Hashes for pixeltable_yolox-0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3482e555047d5421fd45e2e42e15dd293676abe63aadfa16aa197bf7a25fec42
MD5 2369c703a9be423b87214857964279c1
BLAKE2b-256 a12c882c9e5be424311db935e244f6605b390a282542be37f188d5bc5241b4ac

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page