xiezheng-cs / pytorchtocaffe Goto Github PK
View Code? Open in Web Editor NEWA tool for PytorchToCaffe,fork form https://github.com/xxradon/PytorchToCaffe
License: MIT License
A tool for PytorchToCaffe,fork form https://github.com/xxradon/PytorchToCaffe
License: MIT License
import torch
from torchvision.models import resnet
import pytorch_to_caffe
from facenet_pytorch import InceptionResnetV1if name=='main':
name='VGGFace2'
# For a model pretrained on VGGFace2
model = InceptionResnetV1(pretrained='vggface2').eval()input=torch.ones([1, 3, 512, 512]) pytorch_to_caffe.trans_net(model, input, name) pytorch_to_caffe.save_prototxt('{}.prototxt'.format(name)) pytorch_to_caffe.save_caffemodel('{}.caffemodel'.format(name))
Add blob conv_blob13 : torch.Size([1, 256, 61, 61])
140602027406272:cat_blob1 getting
140602027407552:conv_blob13 getting
mul1 was added to layers
140602027406752:mul_blob1 was added to blobs
Add blob mul_blob1 : torch.Size([1, 256, 61, 61])
140602027407552:conv_blob13 getting
Traceback (most recent call last):
File "VGGFace2_pytorch_2_caffe.py", line 14, in
pytorch_to_caffe.trans_net(model, input, name)
File "/home/songdc/Documents/PytorchToCaffe/pytorch_to_caffe.py", line 675, in trans_net
out = net.forward(input_var)
File "/home/songdc/miniconda3/lib/python3.7/site-packages/facenet_pytorch/models/inception_resnet_v1.py", line 288, in forward
x = self.repeat_1(x)
File "/home/songdc/miniconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 489, in call
result = self.forward(*input, **kwargs)
File "/home/songdc/miniconda3/lib/python3.7/site-packages/torch/nn/modules/container.py", line 92, in forward
input = module(input)
File "/home/songdc/miniconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 489, in call
result = self.forward(*input, **kwargs)
File "/home/songdc/miniconda3/lib/python3.7/site-packages/facenet_pytorch/models/inception_resnet_v1.py", line 65, in forward
out = out * self.scale + x
File "/home/songdc/Documents/PytorchToCaffe/pytorch_to_caffe.py", line 552, in _mul
bottom=[log.blobs(input), log.blobs(args[0])], top=top_blobs)
File "/home/songdc/Documents/PytorchToCaffe/pytorch_to_caffe.py", line 101, in blobs
print("{}:{} getting".format(var, self._blobs[var]))
File "/home/songdc/Documents/PytorchToCaffe/pytorch_to_caffe.py", line 39, in getitem
return self.data[key]
KeyError: 140602226322992
torch:1.0
torchvision:0.2
(haven add code torchvison.ops.boxes to facenet_pytorch source code which occur in torchvision>0.3)
Why does the error occur? Thank you!
你好,我正好也要使用FeatherNet 的caffe模型, 我从FeatherNet作者那里下载了模型,他那里的图片输入是224x224,用你的工具尝试转化没有成功。我看到你的FeatherNet模型的输入是112x112,应该成功了吧,可以开源出来吗
最好是使用作者开发的模块 https://github.com/hujie-frank/SENet
具体思路可以分享一下吗?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.