需要torch1.10版本
最快的需要25ms gpu
https://github.com/zsef123/EfficientNets-PyTorch
还有这个:
https://github.com/jacke121/efficientnet-pytorch
1070上:efficientnet-b0
512 batch_seze 1需要25ms, 4需要56ms,batch_size为6就内存溢出
416 batch_seze 1需要25ms, 4需要56ms,batch_size为10就内存溢出
proxyless_gpu batch_size 20 可以,再大就不行了。
def test():
x = torch.FloatTensor(4, 3, 512, 512).cuda()
w, d, _, p = efficientnet_params('efficientnet-b0')
# note: all models have drop connect rate = 0.2
blocks_args, global_params = efficientnet(width_coefficient=w, depth_coefficient=d, dropout_rate=p)
我还整理了更多Python的学习资料
QQ 688244617
免费自取
群里还有其他小伙伴可以一起学习交流
model=EfficientNet(blocks_args, global_params)
model.cuda()
model.eval()
for i in range(2000):
t1 = time.time()
out3= model(x)
# print(out3)
cnt = time.time() - t1
print(cnt, out3.size())
if __name__ == '__main__':
test()
https://github.com/lukemelas/EfficientNet-PyTorch/blob/master/efficientnet_pytorch/model.py