qxcv / caffe2keras

Fork of the caffe2keras converter from @MarcBS (UNMAINTAINED)
Other
17 stars 13 forks source link

'layer type' data not supported #7

Open emmapead opened 7 years ago

emmapead commented 7 years ago

I am trying to use your code to convert DeepYeast from the caffe model zoo to keras. I followed instructions for conversion running this command

python -m caffe2keras M:\Caffe_CPU\DeepYeast\HOwt_png_vgg_A_bn_deploy.prototxt M:\Caffe_CPU\DeepYeast\HOwt_png_vgg_A_bn_iter_130000.caffemodel deepyeastKeras.h5

and changing the deploy file from:

name: "HOwt_png_quick" input: "data" input_shape { dim: 100 dim: 3 dim: 64 dim: 64 } layer { name: "conv1_1" type: "Convolution" bottom: "data" top: "conv1_1" convolution_param { num_output: 64 pad: 1 kernel_size: 3 stride: 1 weight_filler { type: "xavier" } bias_filler { type: "constant" } } } ........

to this:

name: "HOwt_png_quick" input: "data" input_dim: 100 input_dim:3 input_dim:64 input_dim:64 layer{ name:"data" type: "data" top: "data" top:"label" } layer { name: "conv1_1" type: "Convolution" bottom: "data" top: "conv1_1" convolution_param { num_output: 64 pad: 1 kernel_size: 3 stride: 1 weight_filler { type: "xavier" } bias_filler { type: "constant" } } }

and get this error:

Using Theano backend.
Converting model...
CREATING MODEL
Traceback (most recent call last):
File "C:\Users\xx\AppData\Local\Continuum\anaconda3\envs\dlen35\lib\runpy.py", "main", mod_spec) File "C:\Users\xx\AppData\Local\Continuum\anaconda3\envs\dlen35\lib\runpy.py",
exec(code, run_globals)
File "M:\Caffe_CPU\caffe2keras\caffe2keras__main__.py", line 32, in
main() File "M:\Caffe_CPU\caffe2keras\caffe2keras__main__.py", line 22, in main
model = convert.caffe_to_keras(args.prototxt, args.caffemodel, args.debug)
File "M:\Caffe_CPU\caffe2keras\caffe2keras\convert.py", line 358, in caffe_to_keras tuple(config.input_dim[1:]))
File "M:\Caffe_CPU\caffe2keras\caffe2keras\convert.py", line 483, in create_model
'used in this model is not currently supported')
RuntimeError: ('layer type', 'data', 'used in this model is not currently supported')

I just don't understand what it is I am doing wrong. Any ideas?

Original deploy file can be found here http://kodu.ut.ee/~leopoldp/2016_DeepYeast/code/caffe_model/

qxcv commented 7 years ago

The converter only supports type: "input" layers at the moment (in handle_input). Rearranging the input layers to look like this (modulo names & sizes) should make the model work:

layer {
  name: "image"
  type: "Input"
  top: "image"
  input_param {
    shape {
      dim: 1
      dim: 3
      dim: 368
      dim: 368
    }
  }
}

I've attached a working .prototxt which I've previously converted (adapted from Convolutional Pose Machines release):

pose_deploy_resize.txt

emmapead commented 7 years ago

okay, so I changed the input layer and now I am getting this error:

CREATING MODEL Traceback (most recent call last): File "/home/emma/anaconda3/envs/dlenv/lib/python3.5/runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "/home/emma/anaconda3/envs/dlenv/lib/python3.5/runpy.py", line 85, in _run_code exec(code, run_globals) File "/home/emma/Documents/caffe2keras-master/caffe2keras/main.py", line 32, in main() File "/home/emma/Documents/caffe2keras-master/caffe2keras/main.py", line 22, in main model = convert.caffe_to_keras(args.prototxt, args.caffemodel, args.debug) File "/home/emma/Documents/caffe2keras-master/caffe2keras/convert.py", line 358, in caffe_to_keras tuple(config.input_dim[1:])) File "/home/emma/Documents/caffe2keras-master/caffe2keras/convert.py", line 463, in create_model % (bottom, name) AssertionError: Must have computed bottom data before reaching layer conv1_1

any ideas?