This repository provides multiple pretrained YOLOX [1] object detection networks for MATLAB®, trained on the COCO 2017[2] dataset. These object detectors can detect 80 different object categories including person, car, traffic light, etc.
Creator: MathWorks Development
- MATLAB® R2023b or later
- Deep Learning Toolbox™
- Computer Vision Toolbox™
- Computer Vision Toolbox™ Automated Visual Inspection Library
Note: Previous MATLAB® release users can use this branch to download the pretrained models.
Getting Started with YOLOX for Object Detection
Use to code below to perform detection on an example image using the pretrained model.
Note: This functionality requires Deep Learning Toolbox™ and the Computer Vision Toolbox™ Automated Visual Inspection Library. You can install the Computer Vision Toolbox Automated Visual Inspection Library from Add-On Explorer. For more information about installing add-ons, see Get and Manage Add-Ons.
% Read test image.
img = imread(fullfile("data", "inputTeam.jpg"));
% Create a yoloxobjectdetector object to configure a pretrained YOLOX network with a CSP-DarkNet-53 backbone as the feature extractor.
detector = yoloxObjectDetector("small-coco");
% Perform detection using pretrained model.
[bboxes,scores,labels] = detect(detector,I);
% Visualize results.
annotations = string(labels) + ": " + (round(100*scores)) + "%";
img = insertObjectAnnotation(img, "rectangle", bboxes, annotations);
figure, imshow(img);
To train a YOLOX object detection network on a labeled data set, use the trainYOLOXObjectDetector function. You must specify the class names for the data set you use to train the network. Then, train an untrained or pretrained network by using the trainYOLOXObjectDetector function. The training function returns the trained network as a yoloxObjectDetector object.
To learn how to configure and train a YOLOX object detector for transfer learning to detect small objects, see the Detect Defects on Printed Circuit Boards Using YOLOX Network example.
YOLOX is one of the best performing object detectors and is considered as an improvement to the existing YOLO variants such as YOLO v4, and YOLO v5.
[1] Ge, Zheng, Songtao Liu, Feng Wang, Zeming Li, and Jian Sun. "Yolox: Exceeding yolo series in 2021." arXiv preprint arXiv:2107.08430 (2021).
[2] Lin, T., et al. "Microsoft COCO: Common objects in context. arXiv 2014." arXiv preprint arXiv:1405.0312 (2014).
Copyright 2022 - 2024 The MathWorks, Inc.