Comments (4)
Sorry, it is hard to say ... what Keras verison are you using? Do you use theano as backend?
from keras2cpp.
Thanks for your reply! I don't know which Keras version it is, because I used Amazon AWS to run my code instead of building my own machine. It did show it is using theano backend.
At first, I got 'arch["config"]' like this:
{u'layers': [{u'class_name': u'InputLayer', u'inbound_nodes': [], u'config': {u'batch_input_shape': [None, 1, 160, 128], u'sparse': False, u'input_dtype': u'float32', u'name': u'input_1'}, u'name': u'input_1'}, {u'class_name': u'Convolution2D', u'inbound_nodes': [[[u'input_1', 0, 0]]], u'config': {u'W_constraint': None, u'b_constraint': None, u'name': u'convolution2d_1', u'activity_regularizer': None, u'trainable': True, u'dim_ordering': u'th', u'nb_col': 3, u'subsample': [1, 1], u'init': u'glorot_uniform', u'bias': True, u'nb_filter': 32, u'b_regularizer': None, u'W_regularizer': None, u'nb_row': 3, u'activation': u'relu', u'border_mode': u'same'}, u'name': u'convolution2d_1'}, {u'class_name': u'Convolution2D', u'inbound_nodes': [[[u'convolution2d_1', 0, 0]]], ...
There are a lot of 'u'. I searched online and found it was Unicode object. I followed the suggestions to replace your original code "arch = json.loads(arch)" with "arch = yaml.safe_load(arch)" or "arch = simplejson.loads(arch)". Those 'u' disappeared, but the error is still there...
from keras2cpp.
Try to change line 30:
for ind, l in enumerate(arch["config"]):
to
for ind, l in enumerate(arch["layers"]):
This should help, but for sure it will require more custom changes and I can help with this - sorry! You should change this code by yourself for your needs.
from keras2cpp.
Thanks very much! This is very helpful. It seems the layout of arch
varies from case to case. I tried:
for ind, l in enumerate(arch["config"]["layers"]):
and got dumped.nnet
. But test_run_cnn.cc
generated another error:
"Layer is empty, maybe it is not defined? Cannot define network."
The problem lies in keras_model.cc
, keras::KerasModel::load_weights
:
layer_type =="InputLayer"
,
which doesn't meet any of those if...else...
conditions.
I fully understand I am responsible to change it for my own needs. But any directions or suggestions are highly appreciated.
from keras2cpp.
Related Issues (20)
- Network dumping error ! HOT 2
- Support for keras2 HOT 6
- does it support 'Model' model ? HOT 2
- how can I use colored images inputs? HOT 2
- How to port Keras neural network model into C# ? HOT 1
- Looking for a way to receive MSCOCO's Architecture JSON File HOT 1
- When the top layer must be excluded in Keras...
- Running Environment Setting for the Code
- LSTM to CPP, who has good method? HOT 3
- terminate called after throwing an instance of 'std::bad_alloc' HOT 3
- Compatible for python3 and new keras HOT 3
- Right Keras and Tensorflow version? HOT 3
- simpler c++ code HOT 1
- newbie asking
- Conv1D layer support HOT 1
- Cant verify results
- Issue dumping the network to .nnet file HOT 3
- custom model architecture HOT 1
- TypeError: ('Keyword argument not understood:', 'border_mode') HOT 2
- Skip dropout rate error HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from keras2cpp.