Closed River-Cold closed 1 year ago
Yeap, have the same problem, however it occurs only when input height != width
, although their article has table №3 with results for 320 × 230 resolution.
For now I'm advising you to use this implementation of ghostnetv2 https://github.com/rwightman/pytorch-image-models/blob/cf5ac2800cb6c6d151a5fce55d77614d864534d5/timm/models/ghostnet.py, it supports any input sizes. Even though comments in code say that it's original ghostnet, forward pass structure and everything else look similar to this implementation, so I think it actually is ghostnetv2. If I'm mistaken, please feel free to correct me
Thanks for your good question! The released code has be updated to tackle input with height != width.
Only a line of code in 'ghostnetv2_torch.py' is updated, i.e., return out[:,:self.oup,:,:]F.interpolate(self.gate_fn(res),size=out.shape[-1],mode='nearest') to return out[:,:self.oup,:,:]F.interpolate(self.gate_fn(res),size=(out.shape[-2],out.shape[-1]),mode='nearest')
ghostnetv2_torch.py缺少测试的代码,我尝试添加ghostnet.py中的测试代码来测试网络功能 但发现测试过程中出现了报错
RuntimeError: The size of tensor a (80) must match the size of tensor b (64) at non-singleton dimension 2
详细报错信息如下: 在网上查找了一些解决方案有提到是网络本身定义有错误,我猜测是ghost和dfc注意力机制相乘的部分存在问题,可以麻烦您帮忙排查一下这个错误吗?不胜感激!