-
Notifications
You must be signed in to change notification settings - Fork 406
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
speed problem #100
Comments
Hi, 朋友,非常欢迎使用这个仓库!
③你测试的图片基数大概多少?推荐5000张以上的图片,分别测试bs=1, bs=16, bs=32 |
感谢!
# YOLOv5 experimental modules
import torch
from utils.google_utils import attempt_download
if __name__ == "__main__":
load = "runs/yolov5s6_repvgg/weights/best.pt"
save = "runs/yolov5s6_repvgg/weights/best_deploy.pt"
input_size = 640
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
for w in load if isinstance(load, list) else [load]:
attempt_download(w)
ckpt = torch.load(w, map_location=None) # load
torch.save(ckpt, save)
print(f"Done. Befrom weights:({load})")
print(f"Done. Befrom weights:({save})") 貌似不是这个脚本吧。 |
是的,是这个脚本,他会调用yolo.py里面的函数接口,捕捉需要重参化的repvgg block |
我其他设置和您的一样,只是模型定义yaml使用的是四分支,训练结束后,先通过rep_convert再detect,相比于原始yolov5s6,使新模型的FLOPs是其1/4, bs1 detect了1000次 平均为12.5ms,原始yolov5s6为12ms |
检测的数据大概多少张呢 |
1000 |
好的,请问下 |
好的,QQ群里回您 |
好的 |
修复了之前重参化脚本的漏洞: |
使用原始yolov5s6 640输入,速度为12ms,使用下面repvgg_block 640输入为13ms GPU v100
YOLOv5 🚀 by Ultralytics, GPL-3.0 license
Parameters
nc: 80 # number of classes
depth_multiple: 0.33 # model depth multiple
width_multiple: 0.50 # layer channel multiple
anchors:
YOLOv5 v6.0 backbone
backbone:
[from, number, module, args]
[[-1, 1, Conv, [32, 6, 2, 2]], # 0-P1/2
[-1, 1, Conv, [64, 3, 2]], # 1-P2/4
[-1, 1, C3, [64]],
[-1, 1, RepVGGBlock, [128, 3, 2]], # 3-P3/8
[-1, 3, C3, [128]],
[-1, 1, RepVGGBlock, [256, 3, 2]], # 5-P4/16
[-1, 3, C3, [256]],
[-1, 1, RepVGGBlock, [512, 3, 2]], # 7-P5/32
[-1, 3, C3, [512]],
[-1, 1, RepVGGBlock, [768, 3, 2]], # 9-P6/64
[-1, 3, C3, [768]],
[-1, 1, SPPF, [768, 5]], # 11
]
YOLOv5 v6.0 head
head:
[[-1, 1, Conv, [512, 1, 1]],
[-1, 1, nn.Upsample, [None, 2, 'nearest']],
[[-1, 8], 1, Concat, [1]], # cat backbone P5
[-1, 3, C3, [512, False]], # 15
[-1, 1, Conv, [256, 1, 1]],
[-1, 1, nn.Upsample, [None, 2, 'nearest']],
[[-1, 6], 1, Concat, [1]], # cat backbone P4
[-1, 3, C3, [256, False]], # 19
[-1, 1, Conv, [128, 1, 1]],
[-1, 1, nn.Upsample, [None, 2, 'nearest']],
[[-1, 4], 1, Concat, [1]], # cat backbone P3
[-1, 3, C3, [128, False]], # 23 (P3/8-small)
[-1, 1, Conv, [128, 3, 2]],
[[-1, 20], 1, Concat, [1]], # cat head P4
[-1, 3, C3, [256, False]], # 26 (P4/16-medium)
[-1, 1, Conv, [256, 3, 2]],
[[-1, 16], 1, Concat, [1]], # cat head P5
[-1, 3, C3, [512, False]], # 29 (P5/32-large)
[-1, 1, Conv, [512, 3, 2]],
[[-1, 12], 1, Concat, [1]], # cat head P6
[-1, 3, C3, [768, False]], # 32 (P6/64-xlarge)
[[23, 26, 29, 32], 1, Detect, [nc, anchors]], # Detect(P3, P4, P5, P6)
]
The text was updated successfully, but these errors were encountered: