You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ValueError: Expected more than 1 value per channel when training, got input size torch.Size([1, 16, 1, 1]) #4
ValueError: Expected more than 1 value per channel when training, got input size torch.Size([1, 16, 1, 1])
会在这一行,beta = self.sigmoid(self.bn2(self.fc2(self.bn1(self.fc1(x.mean(dim=2, keepdims=True).mean(dim=3, keepdims=True))))))
会莫名其妙出现这个错误,然后早dataloader中使用了drop_last=True仍然没用
Reacted by Glenn Jocher, NSD881293, frostmourne12321 and YAfyy022
------------------ 原始邮件 ------------------
发件人: "nmaac/acon" ***@***.***>;
发送时间: 2021年4月22日(星期四) 中午12:44
***@***.***>;
***@***.******@***.***>;
主题: Re: [nmaac/acon] ValueError: Expected more than 1 value per channel when training, got input size torch.Size([1, 16, 1, 1]) (#4)
巧了 我也出现这个错误了 不会是在yolov5上改的吧
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
Hi @starsky68@xuhao-anhe , seems the error is caused by the batch size value. If you set batch size = 1, please remove the bn layers: beta = self.sigmoid(self.fc2(self.fc1(x.mean(dim=2, keepdims=True).mean(dim=3, keepdims=True))))
Hi @starsky68@xuhao-anhe , seems the error is caused by the batch size value. If you set batch size = 1, please remove the bn layers: beta = self.sigmoid(self.fc2(self.fc1(x.mean(dim=2, keepdims=True).mean(dim=3, keepdims=True))))
Hi @starsky68@xuhao-anhe , seems the error is caused by the batch size value. If you set batch size = 1, please remove the bn layers: beta = self.sigmoid(self.fc2(self.fc1(x.mean(dim=2, keepdims=True).mean(dim=3, keepdims=True))))
Hi @starsky68@xuhao-anhe , seems the error is caused by the batch size value. If you set batch size = 1, please remove the bn layers: beta = self.sigmoid(self.fc2(self.fc1(x.mean(dim=2, keepdims=True).mean(dim=3, keepdims=True))))
感谢你的回复,我们设置的batchsize=8,bn层的除去,会对meta-aconc影响大嘛?
Hi @starsky68@xuhao-anhe , seems the error is caused by the batch size value. If you set batch size = 1, please remove the bn layers: beta = self.sigmoid(self.fc2(self.fc1(x.mean(dim=2, keepdims=True).mean(dim=3, keepdims=True))))
@nmaac I've implemented a bug patch for this in ultralytics/yolov5#2901, but it's not a great solution, as any YOLOv5 model with MetaAconC() activations will not be able to run batch-size 1 inference properly.
Activity
xuhao-anhe commentedon Apr 22, 2021
巧了 我也出现这个错误了 不会是在yolov5上改的吧
starsky68 commentedon Apr 22, 2021
xuhao-anhe commentedon Apr 22, 2021
一样的,我也改了drop_last也没用 找了半天找不到原因,希望博主能解答一下
nmaac commentedon Apr 22, 2021
Hi @starsky68 @xuhao-anhe , seems the error is caused by the batch size value. If you set batch size = 1, please remove the bn layers:
beta = self.sigmoid(self.fc2(self.fc1(x.mean(dim=2, keepdims=True).mean(dim=3, keepdims=True))))starsky68 commentedon Apr 22, 2021
感谢你的回复,我们设置的batchsize=8,bn层的除去,会对meta-aconc影响大嘛?
nmaac commentedon Apr 22, 2021
starsky68 commentedon Apr 22, 2021
感谢你的回复,我们设置的batchsize=8,bn层的除去,会对meta-aconc影响大嘛?
普通的卷积后面是有bn的,然而,你的meta acon不是一个激活函数接口嘛,我就直接调用的,想acon一样,那个是没问题的,目前确实这里的bn是会导致上面的报错的
xuhao-anhe commentedon Apr 22, 2021
请问你解决了吗,解决的话,方便分享一下经验吗?
starsky68 commentedon Apr 22, 2021
直接去掉这两个bn
xuhao-anhe commentedon Apr 22, 2021
去掉激活函数的归一化会不会造成梯度爆炸啊,还是只需要在激活函数之前弄一次归一化就可以了
starsky68 commentedon Apr 22, 2021
去掉此处的两个bn不会造成梯度爆炸,前面有bn啊,
xuhao-anhe commentedon Apr 22, 2021
好嘞 感谢回复
ACON Activation batch-size 1 bug path
glenn-jocher commentedon Apr 22, 2021
@nmaac I've implemented a bug patch for this in ultralytics/yolov5#2901, but it's not a great solution, as any YOLOv5 model with MetaAconC() activations will not be able to run batch-size 1 inference properly.
dosemeion commentedon Apr 24, 2021
不能使用batchsize=1,yolov5里面的yolo.py改成m.stride = torch.tensor([s / x.shape[-2] for x in self.forward(torch.zeros(2, ch, s, s))]) # forward
ACON Activation batch-size 1 bug path
ACON Activation batch-size 1 bug patch (#2901)
ACON Activation batch-size 1 bug patch (ultralytics#2901)
pull updates from original repo (release v5) + reimplement UI (#21)
ACON Activation batch-size 1 bug patch (ultralytics#2901)
songjiahao-wq commentedon Mar 6, 2022
请问是直接修改的conv函数吗?YOLOv5修改后效果很差
ACON Activation batch-size 1 bug patch (ultralytics#2901)
ACON Activation batch-size 1 bug patch (#2901)
ACON Activation batch-size 1 bug patch (#2901)