GithubHelp home page GithubHelp logo

mocha's Introduction

Mocha: Convert torch model to/from caffe model easily

Caffe: load with Python.
Torch: load with Lua.

Q. How to connect Python & Lua code?
A. We don't need directly interact Python code with Lua code, which is complex. We use intermediate file exchange, the model parameters are saved to disk layer by layer as .npy file, and then loaded to caffe/torch separately.

TODO:

  • Caffe split layer -> Torch ConcatTable
  • PReLU
  • More tests

mocha's People

Stargazers

 avatar Gabor Szabo avatar Michael Yuan avatar  avatar zhuc avatar Yuechao Xie avatar Tsun-Yi Yang avatar Andrii Boichuk avatar world4jason avatar Yujie Wang avatar  avatar  avatar

Watchers

 avatar  avatar Gabor Szabo avatar

Forkers

shamangary

mocha's Issues

Wrong bottom_name

This project has very few dependencies, I would like to thank the author. However, there are some problems about the relu layer.

Since the .prototxt file is builded based on the net.json file, and the 'bottom_name' is based on the 'name' in the json file. It will cause error if the relu layer is used since 'top' and 'bottom' name are both not the 'name' of the layer.

Main error:
The 'name' of net_config is not equal to the 'bottom_name' of caffe model
https://github.com/kuangliu/mocha/blob/master/torch/export.lua

https://github.com/kuangliu/mocha/blob/master/caffe/import.py#L115

Example:

layer {
  name: "relu2"
  type: "ReLU"
  bottom: "conv1"
  top: "conv1"
}
layer {
  name: "pool3"
  type: "Pooling"
  bottom: "relu2" ---------------------> wrong, it should be "conv1"
  top: "pool3"
  pooling_param {
    pool: MAX
    kernel_h: 2
    kernel_w: 2
    stride_h: 2
    stride_w: 2
    pad_h: 0
    pad_w: 0
  }
}

How to use this tool?

Hi,
Could you kindly explain how to use this tool? Since there is not much information in READEME.
For example, I have a pre-trained Torch model (nn4.small2.v1.t7) which is from OpenFace,
how to use this tool to convert the Torch model(nn4.small2.v1.t7) to Caffe by this tool?

Thanks,
Victor

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.