利用caffe的Python接口生成prototxt文件

caffe生成lenet-5的deploy.prototxt文件 接前面博客:http://blog.youkuaiyun.com/lanxuecc/article/details/52329708 我学会了用caffe训练自己的测试自己的图片,但是这里测试的是测试数据集,那么如何用训练好的caffemodel测试自己的单张图片呢。下面记录下我用训练好的lenet_iter_10000.caffemodelg来测试mnist图片的整个摸索过程::::生成deploy.prot 阅读详情

Python版本:Python2.7
mnist数据集
博客来源:http://blog.youkuaiyun.com/c406495762/article/details/70306550

如何编译caffe的Python接口就不多说了
下面的代码可以一次生成Lenet网络训练所需的train.prototxt和test.prototxt,还有solver.prototxt

代码:

# -*- coding: UTF-8 -*-
import caffe                                                     #导入caffe包

def create_net(lmdb, mean_file, batch_size, include_acc=False):
    #网络规范
    net = caffe.NetSpec()
    #Data层
    net.data, net.label = caffe.layers.Data(source=lmdb, backend=caffe.params.Data.LMDB, batch_size=batch_size, ntop=2,
                                            transform_param = dict(mean_file=mean_file,scale= 0.00390625))
    #视觉层
    net.conv1 = caffe.layers.Convolution(net.data, num_output=20,kernel_size=5,weight_filler={"type": "xavier"},bias_filler={"type": "constant"})
    net.pool1 = caffe.layers.Pooling(net.conv1, pool=caffe.params.Pooling.MAX, kernel_size=2, stride=2)
    net.conv2 = caffe.layers.Convolution(net.pool1, kernel_size=5, stride=1,num_output=50, pad=0,weight_filler=dict(type='xavier'),bias_filler={"type": "constant"})
    net.pool2 = caffe.layers.Pooling(net.conv2, pool=caffe.params.Pooling.MAX, kernel_size=2, stride=2)
    #全连接层
    net.fc1 = caffe.layers.InnerProduct(net.pool2, num_output=500,weight_filler=dict(type='xavier'),bias_filler={"type": "constant"})
    net.fc_add1 = caffe.layers.InnerProduct(net.fc1, num_output=500,weight_filler=dict(type='xavier'),bias_filler={"type": "constant"})#没什么意义,加一层试试
    net.fc_add2 = caffe.layers.InnerProduct(net.fc_add1, num_output=500,weight_filler=dict(type='xavier'),bias_filler={"type": "constant"})#也没什么意义,再加一层试试
    #激活层
    net.relu1 = caffe.layers.ReLU(net.fc_add2, in_place=True)
    #dropout层
    net.drop3 = caffe.layers.Dropout(net.fc_add2, in_place=True)
    net.fc2 = caffe.layers.InnerProduct(net.fc_add2, num_output=10,weight_filler=dict(type='xavier'))
    #sofemax层
    net.loss = caffe.layers.SoftmaxWithLoss(net.fc2, net.label)
    #训练的prototxt文件不包括Accuracy层,测试的时候需要。
    if include_acc:
        net.acc = caffe.layers.Accuracy(net.fc2, net.label)
        return str(net.to_proto())

    return str(net.to_proto())

def write_net(mean_file,train_proto, train_lmdb, test_proto, val_lmdb):
    #写入prototxt文件
    with open(train_proto, 'w') as f:
        f.write(str(create_net(train_lmdb,mean_file,batch_size = 64)))
    #写入prototxt文件
    with open(test_proto, 'w') as f:
        f.write(str(create_net(val_lmdb,mean_file,batch_size = 100, include_acc = True)))

def write_sovler(my_project_root, solver_proto, train_proto, test_proto):
    sovler_string = caffe.proto.caffe_pb2.SolverParameter()                    #sovler存储
    sovler_string.train_net = train_proto                                    #train.prototxt位置指定
    sovler_string.test_net.append(test_proto)                                 #test.prototxt位置指定
    sovler_string.test_iter.append(100)                                        #10000/100 测试迭代次数
    sovler_string.test_interval = 938                                        #60000/64 每训练迭代test_interval次进行一次测试
    sovler_string.base_lr = 0.01                                            #基础学习率
    sovler_string.momentum = 0.9                                            #动量
    sovler_string.weight_decay = 5e-4                                        #权重衰减
    sovler_string.lr_policy = 'step'                                        #学习策略
    sovler_string.stepsize = 3000                                             #学习率变化频率
    sovler_string.gamma = 0.1                                                  #学习率变化指数
    sovler_string.display = 20                                                #每迭代display次显示结果
    sovler_string.max_iter = 9380                                            #10 epoch 938*10 最大迭代数
    sovler_string.snapshot = 938                                             #保存临时模型的迭代数
    sovler_string.snapshot_prefix = my_project_root + 'mnist/model/mnist'                #模型前缀
    sovler_string.solver_mode = caffe.proto.caffe_pb2.SolverParameter.GPU    #优化模式

    with open(solver_proto, 'w') as f:
        f.write(str(sovler_string))


#def train(solver_proto):
#    caffe.set_device(0)
#    caffe.set_mode_gpu()
#    solver = caffe.SGDSolver(solver_proto)
#    solver.solve()


if __name__ == '__main__':
    my_project_root = "F:/python/make_prototxt/"    #my-caffe-project目录
    train_lmdb = my_project_root + "mnist/data/mnist_train_lmdb"                #train_lmdb文件的位置
    val_lmdb = my_project_root + "mnist/data/mnist_test_lmdb"                    #val_lmdb文件的位置
    train_proto = my_project_root + "mnist/train.prototxt"                #保存train.prototxt文件的位置
    test_proto = my_project_root + "mnist/test.prototxt"                #保存test.prototxt文件的位置
    solver_proto = my_project_root + "mnist/solver.prototxt"            #保存solver.prototxt文件的位置
    mean_file = my_project_root + "mnist/data/trainMean.binaryproto"                          #均值文件的位置

    write_net(mean_file,train_proto, train_lmdb, test_proto, val_lmdb)
    print "生成train.prototxt test.prototxt成功"
    write_sovler(my_project_root, solver_proto, train_proto, test_proto)
    print "生成solver.prototxt成功"
   # train(solver_proto)
   # print "训练完成"

运行结果:
生成的train.prototxt

layer {
  name: "data"
  type: "Data"
  top: "data"
  top: "label"
  transform_param {
    scale: 0.00390625
    mean_file: "F:/python/make_prototxt/mnist/data/trainMean.binaryproto"
  }
  data_param {
    source: "F:/python/make_prototxt/mnist/data/mnist_train_lmdb"
    batch_size: 64
    backend: LMDB
  }
}
layer {
  name: "conv1"
  type: "Convolution"
  bottom: "data"
  top: "conv1"
  convolution_param {
    num_output: 20
    kernel_size: 5
    weight_filler {
      type: "xavier"
    }
    bias_filler {
      type: "constant"
    }
  }
}
layer {
  name: "pool1"
  type: "Pooling"
  bottom: "conv1"
  top: "pool1"
  pooling_param {
    pool: MAX
    kernel_size: 2
    stride: 2
  }
}
layer {
  name: "conv2"
  type: "Convolution"
  bottom: "pool1"
  top: "conv2"
  convolution_param {
    num_output: 50
    pad: 0
    kernel_size: 5
    stride: 1
    weight_filler {
      type: "xavier"
    }
    bias_filler {
      type: "constant"
    }
  }
}
layer {
  name: "pool2"
  type: "Pooling"
  bottom: "conv2"
  top: "pool2"
  pooling_param {
    pool: MAX
    kernel_size: 2
    stride: 2
  }
}
layer {
  name: "fc1"
  type: "InnerProduct"
  bottom: "pool2"
  top: "fc1"
  inner_product_param {
    num_output: 500
    weight_filler {
      type: "xavier"
    }
    bias_filler {
      type: "constant"
    }
  }
}
layer {
  name: "fc_add1"
  type: "InnerProduct"
  bottom: "fc1"
  top: "fc_add1"
  inner_product_param {
    num_output: 500
    weight_filler {
      type: "xavier"
    }
    bias_filler {
      type: "constant"
    }
  }
}
layer {
  name: "fc_add2"
  type: "InnerProduct"
  bottom: "fc_add1"
  top: "fc_add2"
  inner_product_param {
    num_output: 500
    weight_filler {
      type: "xavier"
    }
    bias_filler {
      type: "constant"
    }
  }
}
layer {
  name: "relu1"
  type: "ReLU"
  bottom: "fc_add2"
  top: "fc_add2"
}
layer {
  name: "drop3"
  type: "Dropout"
  bottom: "fc_add2"
  top: "fc_add2"
}
layer {
  name: "fc2"
  type: "InnerProduct"
  bottom: "fc_add2"
  top: "fc2"
  inner_product_param {
    num_output: 10
    weight_filler {
      type: "xavier"
    }
  }
}
layer {
  name: "loss"
  type: "SoftmaxWithLoss"
  bottom: "fc2"
  bottom: "label"
  top: "loss"
}

生成的test.prototxt

layer {
  name: "data"
  type: "Data"
  top: "data"
  top: "label"
  transform_param {
    scale: 0.00390625
    mean_file: "F:/python/make_prototxt/mnist/data/trainMean.binaryproto"
  }
  data_param {
    source: "F:/python/make_prototxt/mnist/data/mnist_test_lmdb"
    batch_size: 100
    backend: LMDB
  }
}
layer {
  name: "conv1"
  type: "Convolution"
  bottom: "data"
  top: "conv1"
  convolution_param {
    num_output: 20
    kernel_size: 5
    weight_filler {
      type: "xavier"
    }
    bias_filler {
      type: "constant"
    }
  }
}
layer {
  name: "pool1"
  type: "Pooling"
  bottom: "conv1"
  top: "pool1"
  pooling_param {
    pool: MAX
    kernel_size: 2
    stride: 2
  }
}
layer {
  name: "conv2"
  type: "Convolution"
  bottom: "pool1"
  top: "conv2"
  convolution_param {
    num_output: 50
    pad: 0
    kernel_size: 5
    stride: 1
    weight_filler {
      type: "xavier"
    }
    bias_filler {
      type: "constant"
    }
  }
}
layer {
  name: "pool2"
  type: "Pooling"
  bottom: "conv2"
  top: "pool2"
  pooling_param {
    pool: MAX
    kernel_size: 2
    stride: 2
  }
}
layer {
  name: "fc1"
  type: "InnerProduct"
  bottom: "pool2"
  top: "fc1"
  inner_product_param {
    num_output: 500
    weight_filler {
      type: "xavier"
    }
    bias_filler {
      type: "constant"
    }
  }
}
layer {
  name: "fc_add1"
  type: "InnerProduct"
  bottom: "fc1"
  top: "fc_add1"
  inner_product_param {
    num_output: 500
    weight_filler {
      type: "xavier"
    }
    bias_filler {
      type: "constant"
    }
  }
}
layer {
  name: "fc_add2"
  type: "InnerProduct"
  bottom: "fc_add1"
  top: "fc_add2"
  inner_product_param {
    num_output: 500
    weight_filler {
      type: "xavier"
    }
    bias_filler {
      type: "constant"
    }
  }
}
layer {
  name: "relu1"
  type: "ReLU"
  bottom: "fc_add2"
  top: "fc_add2"
}
layer {
  name: "drop3"
  type: "Dropout"
  bottom: "fc_add2"
  top: "fc_add2"
}
layer {
  name: "fc2"
  type: "InnerProduct"
  bottom: "fc_add2"
  top: "fc2"
  inner_product_param {
    num_output: 10
    weight_filler {
      type: "xavier"
    }
  }
}
layer {
  name: "loss"
  type: "SoftmaxWithLoss"
  bottom: "fc2"
  bottom: "label"
  top: "loss"
}
layer {
  name: "acc"
  type: "Accuracy"
  bottom: "fc2"
  bottom: "label"
  top: "acc"
}

生成的solver.prototxt

train_net: "F:/python/make_prototxt/mnist/train.prototxt"
test_net: "F:/python/make_prototxt/mnist/test.prototxt"
test_iter: 100
test_interval: 938
base_lr: 0.01
display: 20
max_iter: 9380
lr_policy: "step"
gamma: 0.1
momentum: 0.9
weight_decay: 0.0005
stepsize: 3000
snapshot: 938
snapshot_prefix: "F:/python/make_prototxt/mnist/model/mnist"
solver_mode: GPU

接下来就可以训练了

【2026-Spark实验一-Windows中安装Spark环境】 本文详细介绍了在Windows系统中配置Spark 3.5.8开发环境的完整流程。主要内容包括:安装JDK 8并配置环境变量,下载并解压Spark 3.5.8预编译版,设置SPARK_HOME系统变量,配置Hadoop的winutils工具解决Windows兼容性问题。通过spark-shell和SparkPi示例程序验证环境配置成功,确保Spark能够正常运行分布式计算任务。文中特别强调了路径命名规范、环境变量设置顺序等关键细节,提供了完整的配置截图和验证方法,帮助开发者快速搭建稳定的Spark学习环境。 阅读详情

相关推荐

解锁RK3588视觉潜能:RGA硬件加速库实战指南

本文深入探讨了如何利用RK3588芯片内置的RGA硬件加速库,解决视觉应用中图像预处理的性能瓶颈。通过实战指南,详细介绍了RGA库在YUV转RGB、图像缩放等核心操作上的应用,相比CPU软处理可大幅降低延迟与CPU占用,从而充分释放RK3588的NPU算力,构建高效的AI视觉预处理流水线。

zeta9的博客 669

Caffe——网络配置(prototxt文件)

网络配置数据层卷积层池化层激活函数全连接层显示准确率层softmax层reshape层Dropout层 数据层 数据层是模型最底层,提供提供数据输入和数据从Blobs转换成别的格式进行保存输出,通常数据预处理(减去均值,放大缩小,裁剪和镜像等)也在这一层设置参数实现。 layer { name: "mnist" #名称 type: "Data" #输入的是LMDB数据,前面的create_mnist.sh做了转换 include: { phase:TRIAN #只在训练的时候才包括(测

小白一直白 2173

Java电商秒杀系统性能优化(一)——电商秒杀系统框架回顾

电商秒杀系统框架回顾项目简介外部依赖框架回顾项目要点项目中存在的问题小结 课程是免费的,课程地址如下:SpringBoot搭建电商秒杀项目,课程真的很棒,作者的思路很清晰,建议各位读者可以跟着视频练习一下这个项目; 项目简介 通过SpringBoot快速搭建的前后端分离的电商基础秒杀项目。项目通过应用领域驱动型的分层模型设计方式去完成:用户otp注册、登陆、查看、商品列表、进入商品详情以及倒计时秒...

ghw15221836342的博客 3720

深度学习框架Caffe学习笔记(8)-BP神经网络算法

BP神经网络的计算流程为,先根据输入数据各个节点的权重偏向,计算出神经网络的输出(前向传播计算),通过计算输出与理想输出比较得到误差,再根据误差函数再各个节点的偏导数计算出各权重、偏向的调整量(反向传播计算)。该迭代过程循环进行,直到达到某些停止条件,如训练误差已经小到一定值。

流云非晚的专栏 1万+

统信UOS服务器上,达梦DM8数据库安装避坑全记录(附大小写敏感设置)

本文详细介绍了在统信UOS服务器版上部署达梦DM8数据库的全过程,包括环境准备、安装流程、数据库实例初始化及关键参数配置,特别是大小写敏感设置的注意事项。提供了从系统配置到性能优化的完整指南,帮助用户避免常见问题,确保数据库稳定运行。

weixin_30647423的博客 332

华大HC32F460从零到200MHz:手把手教你配置时钟系统(附避坑指南)

本文详细解析了华大HC32F460 MCU的时钟系统配置,从启动过程、时钟树分析到实战配置200MHz系统时钟。文章手把手指导开发者如何正确配置外部晶振、MPLL锁相环及总线分频,并提供了硬件检查、代码解读及常见问题排查的避坑指南,帮助用户从零构建稳定可靠的高性能时钟环境。

net55的博客 296

Python API 文档自动生成(Sphinx、MkDocs、Swagger)的实现方式

选择合适的工具取决于你的具体需求。如果你需要高度定制化且支持多种输出格式的文档,Sphinx 是一个很好的选择;如果希望快速搭建文档并保持简洁,MkDocs 是不错的选择;而对于需要交互式 API 测试的场景,Swagger 则提供了无与伦比的优势。无论选择哪种工具,编写清晰、准确的文档都是提高开发效率的关键。希望这篇文章能帮助你在 Python 项目中找到最适合自己的 API 文档生成方案。```

2501_91226545的博客 547

Lammps纳米压痕接触面积—Matlab接触面积计算(两种方法)

Lammps纳米压痕接触面积计算

Rockyoung 5448

【caffe】利用protobuf读取prototxt文件

在网上看到了不少使用caffe python接口来编写生成prototxt文件的帖子,也找到了用protobuf的python接口读取caffemodel的方法,不过一直没看到用protobuf读prototxt的方法(我想要用caffe.proto解析,而不是用字符串直接读入)。由于我对protobuf不是很熟悉,想了半天,突然想起caffe提供了用prototxt绘制网络结构图的draw_ne...

花丸大老师的博客 4135

uniapp [安卓苹果App端] - 解决支付宝支付报错requestPayment:fail [payment支付宝:62009]未知错误,使用uni.requestPayment支付报错排查方案

uni-app支付宝,uniapp支付宝沙箱支付报错,uni.requestPayment,uniAPP App支付宝支付提示错误requestPayment:fail [payment支付宝:62009]未知错误,UNI-APP支付宝报错"code": -100,uniapp 解决安卓App使用uni.requestPayment实现沙箱环境支付宝支付报错,uniapp安卓app使用支付宝的沙箱环境支付时报了这个错,安卓端app支付宝支付,在沙箱测试环境测支付,提示“商家订单参数异常,请重新发起付款,选择

🏆 前端领域优质创作者 9609

用 Docker 一键部署 SillyTavern酒馆 mac/windows/linux通用教程,我再也不手动折腾了!

本文介绍了如何使用 Docker 一键部署 SillyTavern 项目,适用于 Mac、Windows 和 Linux 系统。SillyTavern 是一个本地部署的大语言模型聊天界面,支持多种插件和扩展。文章详细说明了安装 Docker、拉取项目、启动容器、配置白名单、启用插件等步骤,并提供了常见问题的解决方法。通过 Docker 部署,用户可以避免繁琐的手动配置,快速搭建和运行 SillyTavern,适合希望简化部署流程的用户。

代码简单说 Vue、JAVA、PHP、Node.js 熟练运用,接口、架构、性能全搞定。 2622

python调用caffe模型_从Python中的caffe .prototxt模型定义读取网络参数

我想从Python中的.prototxt中定义的caffe网络读出网络参数,因为layer_dict中的图层对象只告诉我它是一个“卷积”层,但不包括在.prototxt文件中明确定义的诸如kernel_size,strides等。从Python中的caffe .prototxt模型定义读取网络参数所以可以说我有一个model.prototxt像这样:name: "Model"layer {name...

weixin_42220669的博客 407

YOLOv8首创原创改进:即插即用|创新的轻量化非对称多级压缩LADH检测头

总结而言,本文介绍了一种名为轻量化非对称多级压缩LADH检测头的原创改进,该改进可与YOLOv8无缝适配,并显著提升了检测器的性能。在本文中,我们介绍了一种原创改进的检测头,名为轻量化非对称多级压缩LADH检测头,它可与YOLOv8无缝适配,显著提升了检测器的性能。此外,我们引入了多级压缩的概念,通过在不同的检测层级上应用不同程度的压缩,进一步提升了检测头的轻量化特性。具体而言,我们采用了逐级减少卷积核数量和通道数量的策略,以降低模型的参数量和计算复杂度,同时保持较高的检测精度。

IbcVue的博客 2181

支持caffe的prototxt文件

支持caffe的prototxt文件的神经网络结构在线可视化工具:Netscope/netron 在线链接:http://ethereon.github.io/netscope/#/editor 将caffe文件中的.prototxt文件内容复制到编译框,然后按shaft+enter就可以得到可视化的结构图。参考https://blog.youkuaiyun.com/10km/article/details/52713027 打开地址:http://ethereon.github.io/netscope/#/edito

qq_46834466的博客 296

NTscan扫描工具

ntscan是一个扫描器,可以扫描没有密码和弱密码的共享,先到配置文件中填写猜测的用户名和密码,扫描过程中右侧出现的是扫描日志。

SIMATIC S7-1200, S7-1500 PID 控制[手册]

SIMATIC S7-1200, S7-1500 PID 控制[手册]

利用 caffe 接口构建 CNN 网络

我的研究重点原本是在 Torch 上,我也很喜欢用 Torch 去实现网络。但最近不得不转到 caffe 上。 在实现上篇博文:论文阅读:Reading Text in the Wild with Convolutional Neural Networks 的代码时,在 Bounding Box Regression 部分,需要用 caffe 来实现这个网络。 而一开始我构建论文中

请叫我小皇帝 的博客 537

蓝牙模块HM-10手册

蓝牙模块HM-10手册,该手册对蓝牙模块HM-10进行了详细的介绍和使用方法以及一些AT指令。

使用Python生成caffe所需的train.prototxt、test.prototxt文件

参考博客 Caffe学习笔记(四):使用pycaffe生成train.prototxt、test.prototxt文件 一、环境说明 操作系统:Ubuntu16.04 python版本:python2.7 虚拟环境:Anaconda 虚拟软件:VMware12 caffe下载地址:https://github.com/BVLC/caffe 二、准备工作 参考我的另外一...

IT菜鸟 911

Data-Structures-and-Algorithm-Analysis-in-Java.pdf

作者: Weiss, Mark A. 出版社: Addison Wesley Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course was known as CS7. This text is for readers who want to learn good programming and algorithm analysis skills simultaneously so that they can develop such programs with the maximum amo...

使用Python生成caffe所需的solver.prototxt文件并进行训练

参考博客 Caffe学习笔记(五):使用pycaffe生成solver.prototxt文件并进行训练 一、环境说明 操作系统:Ubuntu16.04 python版本:python2.7 虚拟环境:Anaconda 虚拟软件:VMware12 caffe下载地址:https://github.com/BVLC/caffe 二、准备工作 参考我的另外一篇博客使用Py...

IT菜鸟 925

caffe:生成、修改prototxt及caffemodel解析完整版

1.读取prototxt from caffe.proto import caffe_pb2 from google.protobuf import text_format net = caffe_pb2.NetParameter() solver = caffe_pb2.SolverParameter() f1=open('deploy.prototxt') f2=open('solver.pr...

车牌识别 5684

caffe源码学习——用python定义网络时,源代码生成prototxt文件的原理

caffe源码学习——用python定义网络时,源代码生成prototxt文件的原理(1)概述  一般地,我们大都是使用作者定义好的网络结构来使用网络。即直接使用train.prototxt文件来使用网络,有时候为了方便修改网络参数,使用python代码来定义网络可能就便于管理。因此,该文章主要讲述了源代码中生成prototxt文件的原理。源代码主要在caffe-master/python/caff

LJN101224的博客 1566

在python中编写caffe的prototxt文件

利用python可以创建caffe的网络定义的prototxt文件,利用这种方法的一个好处就是:可以保证training,testing和deploy网络的一致性!下面是利用python编写train和test的prototxt文件的一个小事例:import os from os.path import join import numpy as npimport caffe from caffe i

tina的博客 6945

caffe训练(6)生成solver.prototxt文件

使用python生成solver.prototxt文件 以分析的cifar10_quick_solver.prototxt文件为例,使用python程序,生成这个文件。 1.代码如下: # -*- coding: UTF-8 -*- import caffe #导入caffe包 def wr...

weixin_42535423的博客 392

Caffe学习笔记(四):使用pycaffe生成train.prototxt、test.prototxt文件

了解到上一篇笔记的内容,就可以尝试自己编写python程序生成prototxt文件了,当然也可以直接创建文件进行编写,不过显然,使用python生成这个配置文件更为简洁。之前已说过cifar10是使用cifar10_quick_solver.prototxt配置文件来生成model。

Jack-Cui 2万+

python接口调用已训练好的caffe模型测试分类

训练好了model后,可以通过python调用caffe的模型,然后进行模型测试的输出。 本次测试主要依靠的模型是在caffe模型里面自带训练好的结构参数:~/caffe/models/bvlc_reference_caffenet/bvlc_reference_caffenet.caffemodel,以及结构参数 :~/caffe/models/bvlc_reference_caffenet

Baterforyou的博客 8944

利用python接口生成prototxt文件

import numpy as np import matplotlib.pyplot as plt import sys,os caffe_root = '/home/tyd/caffe/' sys.path.insert(0,caffe_root+'python') from caffe import layers as L from caffe import params as P imp...

qq649185776的博客 513

将python文件做成接口_caffe的python接口学习(5):生成deploy文件

如果要把训练好的模型拿来测试新的图片,那必须得要一个deploy.prototxt文件,这个文件实际上和test.prototxt文件差不多,只是头尾不相同而也。deploy文件没有第一层数据输入层,也没有最后的Accuracy层,但最后多了一个Softmax概率层。这里我们采用代码的方式来自动生成该文件,以mnist为例。deploy.py# -*- coding: utf-8 -*-from ...

weixin_39623716的博客 230

caffe用python产生prototxt文件

caffe通过python写网络结构,通过python生成prototxt

葫芦与瓢的博客 3457
上一篇: 欢迎使用优快云-markdown编辑器
下一篇: 深度学习论文综述
Run_it_faraway
博客等级 码龄10年 19粉丝 11原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值