Computer Vision, Object Detection:

3 views (last 30 days)
Hello:
Can anyone please help with how to train YOLOx detector to detect custom object from an image. I know there are examples but I did not find them to be easy to follow. I have my data set, I would like to prepare them, train the network and detect object. My data has only one class. Could someone point me to good resources on how to do this in MATLAB or explain the process in detail ?
Thank you.

Accepted Answer

Pratyush Swain
Pratyush Swain on 16 Apr 2024
Hi Tewodros,
I understand you have a custom dataset and you want to train a YOLO Detector. To train a YOLO v4 object detection network on a labeled data set, use the "trainYOLOv4ObjectDetector" function.
Firstly you must specify the class names for the data set you intend to use to train the network. Then, train an untrained or pretrained network by using the "trainYOLOv4ObjectDetector" function. The training function returns the trained network as a "yolov4ObjectDetector" object.
You can refer to this crisp example for the same: https://www.mathworks.com/help/vision/ref/trainyolov4objectdetector.html or you can also open the example in your MATLAB Desktop using:
openExample('vision/TrainYOLOV4NetworkForVehicleDetectionExample')
Make sure you have the following installations beforehand:
  • MATLAB® R2022a or later
  • Deep Learning Toolbox
  • Computer Vision Toolbox
The training process in the example mostly consists of 3 main parts:
1- Prepare Training Data:
  • Prepare data which can be loaded as a table with the first column containing the training images filepath and the second column containing the labeled bounding boxes coordinates.
  • Also specify the input size to use for resizing the training images
2- Estimate Anchor Boxes:
3- Configure and Train Yolov4 network:
  • Specify the class names.
  • Configure the pretrained YOLO v4 deep learning network to be retrained for the new dataset by using "yolov4ObjectDetector" function.In the example it has used "tiny-yolov4-coco" as the pretrained model.
  • Finally specify the training options and retrain the pretrained YOLO v4 network on the new dataset.
All these main steps enumerated are followed in detail in the example mentioned above.For an in depth view of object detection using Yolov4 Deep Learning(including data augmentation, evaluation, etc) refer to : https://www.mathworks.com/help/vision/ug/object-detection-using-yolov4-deep-learning.html
Hope this helps.

More Answers (0)

Products


Release

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!