Closed MaajidKhan closed 4 years ago
Hey, from what I remember the code was working with Theano backend. So to use it with TensorFlow you need to provide your own code for transformation (it should be a matter of change in dimension order, so it should be very similar to current code). Sorry that it is not working out of the box.
Please check the following discussion https://stackoverflow.com/questions/36720498/convert-keras-model-to-c to find more similar solutions.
Hi @MaajidKhan for a TensorFlow conversion I think you'll need to change L30 in dump_to_cpp.py
: to: for ind, l in enumerate(arch["config"]["layers"]):
as the json file contains an extra key for "config".
You might then also need to make some edits to how the weights are read in too.
Hope this helps!
Hi @JosephPB , your fix worked for me for working around with Tensorflow backend. Thanks.
Hey, I have issue while dumping the network into dat file. Basically, 2nd step :
while, I run this script dump_to_cpp.py , it throws an error:
Using TensorFlow backend. Read architecture from arch.json Read weights from weights.h5 Writing to converted_to_cpp.dat 0 name Traceback (most recent call last): File "dump_to_cpp.py", line 36, in fout.write('layer ' + str(ind) + ' ' + l['class_name'] + '\n') TypeError: string indices must be integers
The issue is, l should have been of data type 'list' but in our case it is a 'string'.
can you please rectify this issue and provide a working solution.