inference4j/yolox-s
lightweight object detector in ONNX format
2 min read
The model recognizes objects in images and returns their coordinates along with labels from 80 standard COCO dataset categories (people, vehicles, animals, household items). This is an official export of the YOLOX-S architecture by Megvii into the universal ONNX format (an open standard for running AI models across different platforms), mirrored for working with the Java library inference4j. The main advantage over newer versions like YOLOv8 is the permissive Apache-2.0 license for both code and weights, free from the strict restrictions of AGPL. Its compact size of 9 million parameters makes the model easy to integrate into Java backend services and cross-platform applications.
Key features
- Anchor-free YOLOX-S architecture with a decoupled head totaling 9.0 million parameters.
- Support for 80 base object classes from the COCO dataset (ranging from people to household items).
- Fully permissive Apache-2.0 license allowing commercial use without disclosing source code.
- Ready-to-use official ONNX graph opset 11 with a fixed 640×640 pixel input.
What you can do
- Embed object recognition into Java applications or microservices using the inference4j library without spinning up a separate Python server.
- Deploy the model in any environment supporting ONNX Runtime for basic photo and video frame analysis.
Example
try (ObjectDetector detector = YoloXDetector.s().build()) {
List detections = detector.detect(Path.of("street.jpg"));
detections.forEach(d -> System.out.printf("%s (%.0f%%) at [%.0f, %.0f, %.0f, %.0f]%n",
d.label(), d.confidence() * 100,
d.box().x1(), d.box().y1(), d.box().x2(), d.box().y2()));
}
Read more
DetailsQuality metric: 40.5 COCO AP (on the val2017 validation set at 640×640 resolution).
Trained from scratch on COCO 2017 train without ImageNet pre-training.
Input: tensor [1, 3, 640, 640] in BGR format (values 0–255, without mean/std normalization) with padding filled with value 114.
Post-processing (coordinate decoding and NMS with an IoU threshold of 0.45) is performed outside the ONNX graph.










Comments