Code Monkey home page Code Monkey logo

Comments (3)

solrex avatar solrex commented on July 29, 2024

@liuguoyou 这个出错信息的意思是你没有安装 Python caffe module,需要你用原始的 caffe 代码编译安装。使用 protobin 能够大幅度缩小 app 的大小,并且提升初始化速度。

from caffe-mobile.

yanghuanflc avatar yanghuanflc commented on July 29, 2024

也可以把build/include/caffe/proto/caffe_pb2.py拷贝到tools路径下,修改prototxt2bin.py为:

#!/usr/bin/env python
import sys
from os import path
import caffe_pb2
from google.protobuf import text_format

if len(sys.argv) < 2:
    print("Usage: ./prototxt2bin.py net.prototxt")

for filename in sys.argv[1:]:
  basename, extname = path.splitext(filename)
  if extname == '.prototxt':
    print("Read Caffe net text from: " + filename)
    params = caffe_pb2.NetParameter()
    with open(filename, 'rt') as f:
      text_format.Merge(f.read(), params)
    print("Write Caffe net binary to: " + basename + '.protobin')
    with open(basename + '.protobin', 'wb') as f:
      f.write(params.SerializeToString())

运行即可

from caffe-mobile.

solrex avatar solrex commented on July 29, 2024

@yanghuanflc 非常感谢,而且我觉得不用拷贝文件,可以直接用 importlib 。既然是你的提议,不知是否愿意发个 pull request?

from caffe-mobile.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.