YOLOR or YOLOv5 (which one is better)?
YOLO (R or v5) both are object detection algorithms, Before going towards comparison, let's discuss what object detection is.
Object-detection technology is widely used as the backend of many applications in the industry including desktop and web applications. Also, it’s a backbone for many computer vision tasks, which include object segmentation, object tracking, object classification, object counting, etc. In the modern era, The goal of everyone regarding any application is,
The application must be easy to use, take less processing time, and provide the best results.
In the previous few years, many new object detection models came, and every one has its advantages and disadvantages, but until now the best object detection models in terms of speed & accuracy include YOLOv4, YOLOv5, YOLOv7 & YOLO-R.
YOLOv5:
YOLOv5 is a modern object detection algorithm, that has been written in a PyTorch, Besides this, it has, fast speed, high accuracy, easy to install and use.
The importance of YOLOv5 was raised, due to its different export and deployment modules. We can convert the trained model (.pt) into many extensions i.e.,
- torch(.pt) → TensorFlow-lite(.tflite) {for android development, etc)
- torch → open-neural network-exchange (.onnx) {for cross platforms}
- torch → Tensorrt-engine (.trt/.engine) {for Tensorrt integration)
YOLOv5 has different model variations including, yolov5s(small), yolov5m(medium), yolov5l(large), yolov5x(extra-large). Let’s look at the accuracy of these variations.
You can see that the YOLOv5 variant's mean average precision (map) started at 36% and ended at 55%. Going from yolov5s →yolov5l, accuracy has been increased, but not too much.
Yolov5s and yolov5m are developed by keeping the idea of embedded devices so that both of them are easily integrated with embedded devices. Both of them provide good fps on Jetson Nano and other embedded devices with less usage of memory.
For more detail, you can check YOLOv5 documentation & YOLOv5 GitHub.
YOLO-R:
YOLO-R also belongs to the category of object detection algorithms, written in both (TensorFlow & PyTorch), It has high accuracy, easy to install and use. The importance of YOLO-R is due to its high accuracy and F1 Score. YOLO-R has different model variations including, YOLOR-p6(small), yolorw6(medium), YOLOR-d6(large), YOLOR-e6(extra-large). Let’s look at the accuracy of YOLOR with other object detection algorithms.
You can see that the YOLOR variant's mean average precision (map) started from 54% and increased with different variations going from YOLOR-p6 → YOLOR-w6. YOLOR-p6 is good for embedded devices, other variations like (w6, and d6) are not good for embedded devices, because they require much time and a huge memory for processing
For more details, you can check YOLO-R GitHub.
Comparison:
Each of them has its advantages and disadvantages. Below I have discussed important advantages and disadvantages, that need to be kept in mind when using any of both.
- In terms of accuracy, YOLOR is best as compared to YOLOv5, because YOLOR means average precision starts from (54%) and ends at 68%. while in YOLOv5 mean average precision starts from 35% and ends at 55%.
- In embedded devices (like RaspberryPI, Jetson, etc.) where the major issue is to reduce memory usage and processing time, YOLOv5 is a better solution than YOLOR in these cases. YOLOv5 provides better FPS than YOLOR. Also, its accuracy is not very low, as compared to the accuracy of YOLOR.
- In both (YOLOR and YOLOv5), the mean average precision is mainly dependent on data labeling, data quality, and parameter optimization.
- YOLOv5 is more popular compared to YOLOR. Because of its export and deployments in different formats. We can export YOLOv5 trained model in different formats including (.pt, .onnx, .trt, .pb, .torchscript,. Core-ml, .tflite, .edgetpu, etc), with its official export.py script. While in YOLOR you don't have many options to export output in different formats, you will have to develop a custom script for new format conversions if you need it.
- YOLOv5 has been developed by keeping the idea of YOLOv4, to enhance its accuracy, while YOLOR is developed by keeping the idea of scaled YOLOv4, to enhance its accuracy.
- Image size matters in both (YOLOv5 & YOLOR). The medium size of the Image (320, 416) during the training of the model is better to achieve the best FPS with a minor drop in accuracy and this is suitable for Jetson or Embedded devices. The large size of the Image (640,1280) is better for achieving good accuracy with the drop in some FPS, and this is most suitable when accuracy is the most important factor than FPS.
Conclusion:
If you want to use these models on scenarios where your major concern is accuracy only, then YOLOR is the best solution, and if you want to run these on scenarios, where you are much concerned about FPS and your device memory is small (like 500MB, 2GB, 4GB), then in these situations YOLOv5 is the best solution.
That is all regarding “YOLOR or YOLOv5 (which one is better)?”. You can use algorithms according to the discussed points above.
Note:
In custom training of both these, if you have to face any issues, You can visit the mentioned links to read my articles about custom training of YOLOv5 and YOLOR.
About Me
- Muhammad Rizwan Munawar is a highly experienced professional with more than three years of work experience in Computer Vision and Software Development. He is working as a Computer Vision Engineer and has knowledge and expertise in different computer vision techniques including Object Detection, Object Tracking, Pose Estimation, Object Segmentation, Segment Anything, Python, and Software Development, Embedded Systems, Nvidia Embedded Devices. In his free time, he likes to play online games and enjoys his time sharing knowledge with the community through writing articles on Medium.
Please feel free to comment if you have any questions 🙂, If you like the article, Let’s connect on LinkedIn :) 👇
