YOLOv5 Focus() Layer #3181
Replies: 3 comments 8 replies
-
Is there comparative results between the YOLOV5 with YOLOv3 original layers and Focus layer in terms of mAP? |
Beta Was this translation helpful? Give feedback.
-
@glenn-jocher Thank you for your great work [[-1, 1, Conv, [64, 6, 2, 2]], # 0-P1/2 Is the first line [[-1, 1, Conv, [64, 6, 2, 2]], # 0-P1/2 represents the Focus? |
Beta Was this translation helpful? Give feedback.
-
What is the purpose of using a focus structure? slicing the image into 4 parts and then passing them through a conv layer, how does it help, in yolov5? thanks. cc: @glenn-jocher |
Beta Was this translation helpful? Give feedback.
-
I've received lots of interest in the YOLOv5 🚀 Focus layer, so I've written a short documentation here on it. I created the Focus layer myself when evolving the YOLOv3 architecture into YOLOv5, and did not adopt it from other sources. The main purpose of the Focus layer is to reduce layers, reduce parameters, reduce FLOPS, reduce CUDA memory, increase forward and backward speed while minimally impacting mAP.
yolov5/models/common.py
Lines 163 to 171 in 17b0f71
The YOLOv5 Focus layer replaces the first 3 YOLOv3 layers with a single layer:
I settled on the current Focus layer design after a significant effort profiling alternative designs to the YOLOv3 input layers, both for immediate forward/backward/memory profiling results, and also comparing full 300 epoch COCO trainings to determine the effect on mAP. You can profile the Focus layer very easily against the YOLOv3 original layers replaced using the YOLOv5
profile()
function:In our YOLOv5 Google Colab notebook I get the following result:
GPU
device=0
CPU
device='cpu'
Beta Was this translation helpful? Give feedback.
All reactions