spongebab / yolov5 Goto Github PK
View Code? Open in Web Editor NEWThis project forked from ultralytics/yolov5
YOLOv5 ๐ in PyTorch > ONNX > CoreML > TFLite
Home Page: https://ultralytics.com/yolov5
License: GNU General Public License v3.0
This project forked from ultralytics/yolov5
YOLOv5 ๐ in PyTorch > ONNX > CoreML > TFLite
Home Page: https://ultralytics.com/yolov5
License: GNU General Public License v3.0
bifpn็ๆนๅจๅฏไปฅๆนๅจ sใn็็ๆฌไธ้ขๅ๏ผ
็ฎๅๆ็ๅฐ็ๆนๅจ้ฝๆฏๅจ xใl่ฟ็งๅคง็ๆฌไธ้ข็ใ
yolov5-m-four
# Parameters
nc: 80 # number of classes
depth_multiple: 0.67 # model depth multiple
width_multiple: 0.75 # layer channel multiple
anchors: 3
# - [10,13, 16,30, 33,23] # P3/8
# - [30,61, 62,45, 59,119] # P4/16
# - [116,90, 156,198, 373,326] # P5/32
# YOLOv5 backbone
backbone:
# [from, number, module, args]
[ [ -1, 1, Focus, [ 64, 3 ] ], # 0-P1/2
[ -1, 1, Conv, [ 128, 3, 2 ] ], # 1-P2/4
[ -1, 3, C3, [ 128 ] ],
[ -1, 1, Conv, [ 256, 3, 2 ] ], # 3-P3/8
[ -1, 9, C3, [ 256 ] ],
[ -1, 1, Conv, [ 512, 3, 2 ] ], # 5-P4/16
[ -1, 9, C3, [ 512 ] ],
[ -1, 1, Conv, [ 1024, 3, 2 ] ], # 7-P5/32
[ -1, 1, SPP, [ 1024, [ 5, 9, 13 ] ] ],
[ -1, 3, C3, [ 1024, False ] ], # 9
]
# YOLOv5 head
head:
[ [ -1, 1, Conv, [ 512, 1, 1 ] ],
[ -1, 1, nn.Upsample, [ None, 2, 'nearest' ] ],
[ [ -1, 6 ], 1, Concat, [ 1 ] ], # cat backbone P4
[ -1, 3, C3, [ 512, False ] ], # 13
[ -1, 1, Conv, [ 256, 1, 1 ] ],
[ -1, 1, nn.Upsample, [ None, 2, 'nearest' ] ],
[ [ -1, 4 ], 1, Concat, [ 1 ] ], # cat backbone P3
[ -1, 3, C3, [ 256, False ] ], # 17 (P3/8-small)
[ -1, 1, Conv, [ 128, 1, 1 ] ],
[ -1, 1, nn.Upsample, [ None, 2, 'nearest' ] ],
[ [ -1, 2 ], 1, Concat, [ 1 ] ], # cat backbone P2
[ -1, 1, C3, [ 128, False ] ], # 21 (P2/4-xsmall)
[ -1, 1, Conv, [ 128, 3, 2 ] ],
[ [ -1, 18 ], 1, Concat, [ 1 ] ], # cat head P3
[ -1, 3, C3, [ 256, False ] ], # 24 (P3/8-small)
[ -1, 1, Conv, [ 256, 3, 2 ] ],
[ [ -1, 14 ], 1, Concat, [ 1 ] ], # cat head P4
[ -1, 3, C3, [ 512, False ] ], # 20 (P4/16-medium)
[ -1, 1, Conv, [ 512, 3, 2 ] ],
[ [ -1, 10 ], 1, Concat, [ 1 ] ], # cat head P5
[ -1, 3, C3, [ 1024, False ] ], # 23 (P5/32-large)
[ [ 21, 24, 27, 30 ], 1, Detect, [ nc, anchors ] ], # Detect(P2, P3, P4, P5)
]
result:
yolov5m:
val: Scanning '..\Dataset\desk_3_400\valid.cache' images and labels... 50 found, 0 missing, 0 empty, 0 corrupted: 100%|โโโโโโโโโโ| 50/50 [00:00<?, ?it/s]
Class Images Labels P R [email protected] [email protected]:.95: 100%|โโโโโโโโโโ| 25/25 [00:04<00:00, 6.17it/s]
all 50 1532 0.994 0.964 0.988 0.764
Speed: 0.4ms pre-process, 20.2ms inference, 2.7ms NMS per image at shape (2, 3, 640, 640)
Results saved to runs\test\desk-400-m-640-300-bs3-bs2
mAp: 0.764, latency: 23.3ms
yolov5m-four:
val: Scanning '..\Dataset\desk_3_400\valid.cache' images and labels... 50 found, 0 missing, 0 empty, 0 corrupted: 100%|โโโโโโโโโโ| 50/50 [00:00<?, ?it/s]
Class Images Labels P R [email protected] [email protected]:.95: 100%|โโโโโโโโโโ| 25/25 [00:04<00:00, 5.25it/s]
all 50 1532 0.989 0.945 0.982 0.745
Speed: 0.4ms pre-process, 27.6ms inference, 3.2ms NMS per image at shape (2, 3, 640, 640)
Results saved to runs\test\desk-400-m-four-640-300-bs2-bs2
mAP: 0.745, latency: 31.2ms
yolov5m: mAp: 0.764, latency: 23.3ms
yolov5m-four: mAP: 0.745, latency: 31.2ms
I think the reason for the lower mAP is batch-size.
yolov5-PANet-fourhead
# Parameters
nc: 80 # number of classes
depth_multiple: 1.0 # model depth multiple
width_multiple: 1.0 # layer channel multiple
anchors: 3
# - [ 10,13, 16,30, 33,23 ] # P3/8
# - [ 30,61, 62,45, 59,119 ] # P4/16
# - [ 116,90, 156,198, 373,326 ] # P5/32
# - [ 5,7, 8,12, 15,13 ] # P2/4 # custom
# - [ 10,13, 16,30, 33,23 ] # P3/8
# - [ 30,61, 62,45, 59,119 ] # P4/16
# - [ 116,90, 156,198, 373,326 ] # P5/32
# YOLOv5 backbone
backbone:
# [from, number, module, args]
[ [ -1, 1, Focus, [ 64, 3 ] ], # 0-P1/2
[ -1, 1, Conv, [ 128, 3, 2 ] ], # 1-P2/4
[ -1, 3, BottleneckCSP, [ 128 ] ],
[ -1, 1, Conv, [ 256, 3, 2 ] ], # 3-P3/8
[ -1, 9, BottleneckCSP, [ 256 ] ],
[ -1, 1, Conv, [ 512, 3, 2 ] ], # 5-P4/16
[ -1, 9, BottleneckCSP, [ 512 ] ],
[ -1, 1, Conv, [ 1024, 3, 2 ] ], # 7-P5/32
[ -1, 1, SPP, [ 1024, [ 5, 9, 13 ] ] ],
[ -1, 3, BottleneckCSP, [ 1024, False ] ], # 9
]
# YOLOv5 PANet head
head:
[ [ -1, 1, Conv, [ 512, 1, 1 ] ],
[ -1, 1, nn.Upsample, [ None, 2, 'nearest' ] ],
[ [ -1, 6 ], 1, Concat, [ 1 ] ], # cat backbone P4
[ -1, 3, BottleneckCSP, [ 512, False ] ], # 13
[ -1, 1, Conv, [ 256, 1, 1 ] ],
[ -1, 1, nn.Upsample, [ None, 2, 'nearest' ] ],
[ [ -1, 4 ], 1, Concat, [ 1 ] ], # cat backbone P3
[ -1, 3, BottleneckCSP, [ 256, False ] ], # 17 (P3/8-small)
[ -1, 1, Conv, [ 128, 1, 1 ] ],
[ -1, 1, nn.Upsample, [ None, 2, 'nearest' ] ],
[ [ -1, 2 ], 1, Concat, [ 1 ] ], # cat backbone P2
[ -1, 3, BottleneckCSP, [ 128, False ] ], # 17 (P2/4-small)
[ -1, 1, Conv, [ 128, 3, 2 ] ],
[ [ -1, 18 ], 1, Concat, [ 1 ] ], # cat head P3
[ -1, 3, BottleneckCSP, [ 256, False ] ], # 17 (P3/8-small)
[ -1, 1, Conv, [ 256, 3, 2 ] ],
[ [ -1, 14 ], 1, Concat, [ 1 ] ], # cat head P4
[ -1, 3, BottleneckCSP, [ 512, False ] ], # 20 (P4/16-medium)
[ -1, 1, Conv, [ 512, 3, 2 ] ],
[ [ -1, 10 ], 1, Concat, [ 1 ] ], # cat head P5
[ -1, 3, BottleneckCSP, [ 1024, False ] ], # 23 (P5/32-large)
[ [ 14, 17, 20, 23 ], 1, Detect, [ nc, anchors ] ], # Detect(P3, P4, P5)
]
@glenn-jocher Can you help me with this?yolov5-panet four head(p5).I modified the network as the format of P6. But AP is not normal. What went wrong?
Epoch gpu_mem box obj cls total labels img_size
297/299 3.22G 0.01925 0.0256 0 0.04485 133 640: 100%|โโโโโโโโโโ| 117/117 [00:35<00:00, 3.30it/s]
Class Images Labels P R [email protected] [email protected]:.95: 100%|โโโโโโโโโโ| 9/9 [00:01<00:00, 5.17it/s]
all 50 1532 0.0064 0.0627 0.000436 4.9e-05
Epoch gpu_mem box obj cls total labels img_size
298/299 3.22G 0.01946 0.02482 0 0.04428 87 640: 100%|โโโโโโโโโโ| 117/117 [00:35<00:00, 3.28it/s]
Class Images Labels P R [email protected] [email protected]:.95: 100%|โโโโโโโโโโ| 9/9 [00:01<00:00, 5.09it/s]
all 50 1532 0.0066 0.0646 0.000461 5.19e-05
Epoch gpu_mem box obj cls total labels img_size
299/299 3.22G 0.01916 0.02602 0 0.04517 75 640: 100%|โโโโโโโโโโ| 117/117 [00:35<00:00, 3.31it/s]
Class Images Labels P R [email protected] [email protected]:.95: 100%|โโโโโโโโโโ| 9/9 [00:02<00:00, 3.40it/s]
all 50 1532 0.00629 0.0614 0.00042 4.61e-05
biFPN: https://arxiv.org/pdf/1911.09070.pdf
This feature had been implemented by Official code: https://github.com/ultralytics/yolov5/blob/master/models/hub/yolov5-bifpn.yaml
original issue: ultralytics#3993
yolov5s-four head.
yaml:
# Parameters
nc: 80 # number of classes
depth_multiple: 0.33 # model depth multiple
width_multiple: 0.50 # layer channel multiple
anchors: 3
# - [10,13, 16,30, 33,23] # P3/8
# - [30,61, 62,45, 59,119] # P4/16
# - [116,90, 156,198, 373,326] # P5/32
# YOLOv5 backbone
backbone:
# [from, number, module, args]
[ [ -1, 1, Focus, [ 64, 3 ] ], # 0-P1/2
[ -1, 1, Conv, [ 128, 3, 2 ] ], # 1-P2/4
[ -1, 3, C3, [ 128 ] ],
[ -1, 1, Conv, [ 256, 3, 2 ] ], # 3-P3/8
[ -1, 9, C3, [ 256 ] ],
[ -1, 1, Conv, [ 512, 3, 2 ] ], # 5-P4/16
[ -1, 9, C3, [ 512 ] ],
[ -1, 1, Conv, [ 1024, 3, 2 ] ], # 7-P5/32
[ -1, 1, SPP, [ 1024, [ 5, 9, 13 ] ] ],
[ -1, 3, C3, [ 1024, False ] ], # 9
]
# YOLOv5 head
head:
[ [ -1, 1, Conv, [ 512, 1, 1 ] ],
[ -1, 1, nn.Upsample, [ None, 2, 'nearest' ] ],
[ [ -1, 6 ], 1, Concat, [ 1 ] ], # cat backbone P4
[ -1, 3, C3, [ 512, False ] ], # 13
[ -1, 1, Conv, [ 256, 1, 1 ] ],
[ -1, 1, nn.Upsample, [ None, 2, 'nearest' ] ],
[ [ -1, 4 ], 1, Concat, [ 1 ] ], # cat backbone P3
[ -1, 3, C3, [ 256, False ] ], # 17 (P3/8-small)
[ -1, 1, Conv, [ 128, 1, 1 ] ],
[ -1, 1, nn.Upsample, [ None, 2, 'nearest' ] ],
[ [ -1, 2 ], 1, Concat, [ 1 ] ], # cat backbone P2
[ -1, 1, C3, [ 128, False ] ], # 21 (P2/4-xsmall)
[ -1, 1, Conv, [ 128, 3, 2 ] ],
[ [ -1, 18 ], 1, Concat, [ 1 ] ], # cat head P3
[ -1, 3, C3, [ 256, False ] ], # 24 (P3/8-small)
[ -1, 1, Conv, [ 256, 3, 2 ] ],
[ [ -1, 14 ], 1, Concat, [ 1 ] ], # cat head P4
[ -1, 3, C3, [ 512, False ] ], # 20 (P4/16-medium)
[ -1, 1, Conv, [ 512, 3, 2 ] ],
[ [ -1, 10 ], 1, Concat, [ 1 ] ], # cat head P5
[ -1, 3, C3, [ 1024, False ] ], # 23 (P5/32-large)
[ [ 21, 24, 27, 30 ], 1, Detect, [ nc, anchors ] ], # Detect(P2, P3, P4, P5)
]
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.