-
-
Notifications
You must be signed in to change notification settings - Fork 16.2k
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
About the use of MixConv2d #5403
Comments
@Zengyf-CVer see MixConv2d module for input requirements: Lines 49 to 71 in ed887b5
|
@Zengyf-CVer Conv() module for comparison: Lines 36 to 46 in ed887b5
|
@glenn-jocher import torch
from utils.torch_utils import profile
from models.experimental import MixConv2d
m = MixConv2d(128, 256, (3, 5), 1)
results = profile(input=torch.randn(16, 128, 80, 80), ops=[m], n=1) Error message:
Is there a bug for MixConv2d? |
@Zengyf-CVer I cam able to reproduce this error (thank you for the code to reproduce!), may be a bug, will investigate. |
TODO: Possible MixConv2d() bug |
@Zengyf-CVer based on a re-read of the MixConv paper I don't understand why I put a shortcut into the current module. The reason for the error is that the forward function includes a sum of the input to the output, and the input and outputs of course have different channel counts (128 and 256), causing the error. I will remove the shortcut and push a fix. def forward(self, x):
return x + self.act(self.bn(torch.cat([m(x) for m in self.m], 1))) |
@Zengyf-CVer good news 😃! Your original issue may now be fixed ✅ in PR #5410. To verify this fix: import torch
from utils.torch_utils import profile
from models.experimental import MixConv2d
from models.common import Conv
m1 = MixConv2d(128, 256, (3, 5), 1)
m2 = Conv(128, 256, 3, 1)
results = profile(input=torch.randn(16, 128, 80, 80), ops=[m1, m2], n=3)
YOLOv5 🚀 v6.0-39-g3d9a368 torch 1.9.0+cu111 CUDA:0 (Tesla P100-PCIE-16GB, 16280.875MB)
Params GFLOPs GPU_mem (GB) forward (ms) backward (ms) input output
4864 0.9961 0.684 4.922 12.76 (16, 128, 80, 80) (16, 256, 80, 80)
295424 60.5 0.990 9.727 8.917 (16, 128, 80, 80) (16, 256, 80, 80) To receive this update:
Thank you for spotting this issue and informing us of the problem. Please let us know if this update resolves the issue for you, and feel free to inform us of any other issues you discover or feature requests that come to mind. Happy trainings with YOLOv5 🚀! |
@glenn-jocher
How should I use this MixConv2d method? I did an experiment and replaced Conv directly with the MixConv2d method, and found that it couldn't run:
Console output information:
I found that the problem with this
k
, how do I set thisk
?yolov5/models/experimental.py
Line 53 in ed887b5
The text was updated successfully, but these errors were encountered: