【模型转换】PyTorch模型转Caffe模型

一、Caffe模型转换源码下载

GitHub:https://github.com/xxradon/PytorchToCaffe

GitHub上拉取PytorchToCaffe的源码,将Caffe文件夹和pytorch_to_caffe.py文件放到项目根目录

二、将VGG的PyTorch模型转为Caffe模型

cpp 复制代码
import sys
sys.path.insert(0,'.')
import torch
from torch.autograd import Variable
from torchvision.models.vgg import vgg11_bn
import pytorch_to_caffe

if __name__=='__main__':
    name='vgg11_bn'
    net=vgg11_bn(True)
    input=Variable(torch.ones([1,3,224,224]))
    pytorch_to_caffe.trans_net(net,input,name)
    pytorch_to_caffe.save_prototxt('{}.prototxt'.format(name))
    pytorch_to_caffe.save_caffemodel('{}.caffemodel'.format(name))
相关推荐
华玥作者1 天前
[特殊字符] VitePress 对接 Algolia AI 问答(DocSearch + AI Search)完整实战(下)
前端·人工智能·ai
AAD555888991 天前
YOLO11-EfficientRepBiPAN载重汽车轮胎热成像检测与分类_3
人工智能·分类·数据挖掘
王建文go1 天前
RAG(宠物健康AI)
人工智能·宠物·rag
ALINX技术博客1 天前
【202601芯动态】全球 FPGA 异构热潮,ALINX 高性能异构新品预告
人工智能·fpga开发·gpu算力·fpga
易营宝1 天前
多语言网站建设避坑指南:既要“数据同步”,又能“按市场个性化”,别踩这 5 个坑
大数据·人工智能
春日见1 天前
vscode代码无法跳转
大数据·人工智能·深度学习·elasticsearch·搜索引擎
Drgfd1 天前
真智能 vs 伪智能:天选 WE H7 Lite 用 AI 人脸识别 + 呼吸灯带,重新定义智能化充电桩
人工智能·智能充电桩·家用充电桩·充电桩推荐
DeniuHe1 天前
torch.distribution函数详解
pytorch
萤丰信息1 天前
AI 筑基・生态共荣:智慧园区的价值重构与未来新途
大数据·运维·人工智能·科技·智慧城市·智慧园区
盖雅工场1 天前
排班+成本双管控,餐饮零售精细化运营破局
人工智能·零售餐饮·ai智能排班