Comments (4)
@kaya27
Please paste your code here with the error information.
from cnn_keras.
thank you for your reply, I'm a beginner to CNN networks
here is the code:
graph = Graph()
graph.add_input(name='cap', input_shape=(1,), dtype=int)
graph.add_input(name='pref', input_shape=(1,), dtype=int)
graph.add_input(name="pre_word_emb", input_shape=(None, embeddings_dim), dtype="float")
graph.add_node(Embedding(suff_size, suff_dim, init='glorot_uniform'), name="prefix", input="pref")
graph.add_node(Embedding(cap_size, cap_dim, init='glorot_uniform'), name="capitalization", input="cap")
graph.add_node(Convolution2D(400, 5, 5, activation='relu'), name='conv1', inputs=inputs=["prefix","capitalization","pre_word_emb"])
graph.add_node(MaxPooling2D(pool_size=(2, 2)), name='pool1', input='conv1')
graph.add_node(Convolution2D(44, 3, 3, activation='relu'), name='conv2', input='pool1')
graph.add_node(MaxPooling2D(pool_size=(2, 2)), name='pool2', input='conv2')
graph.add_node(Dropout(0.25), name='drop', input='pool2')
graph.add_node(Flatten(), name='flatten', input='drop')
graph.add_node(Dense(640, activation='relu'), name='ip', input='flatten')
graph.add_node(Dropout(0.5), name='drop_out', input='ip')
graph.add_node(Dense(19, activation='softmax'), name='result', input='drop_out')
graph.add_output(name='output', input='result')
graph.compile(optimizer='adadelta',loss={'output': 'categorical_crossentropy'})
print(graph.summary())
the error message is:
graph.add_node(Convolution2D(400, 5, 5, activation='relu'), name='conv1', inputs=["suff_emb","capitalization","pre_word_emb"])
AssertionError: Incompatible shapes: layer expected input with ndim=4 but previous layer has output_shape (None, None, 310)
thanks in advance
from cnn_keras.
Sorry but I haven't used the layer inputs with the "layer list" and even the Embedding layer or integrate them, actually I'm a beginner too😄. But the error tip means your inputs is wrong, I guess that after the shape (1,) and (1,) was embedded, it's "dim" may doesn't work, because a dimension with shape 1 can mean no this dimension. another possibility is that the code grammar may be wrong somewhere.
I remember that the layer's input and output can be checked, but I forget how to do that. The keras's Docs may help😁.
from cnn_keras.
thank you for your reply :) I will check the keras Docs
but as I have understand from the error message the problem is on shapes
I will told you when I will solve it (I hope :p )
have great day!
from cnn_keras.
Related Issues (19)
- 学习一下,请问你用来训练的数据是人工一个个做出来的吗? HOT 6
- Could you upload sample_all and sample_single files? HOT 1
- 可以提供training data 的位置和档名 HOT 2
- About dataset for trainning HOT 11
- ImportError: No module named core HOT 1
- is possible break this? HOT 1
- ==问下这种怎么分割 HOT 20
- shape problem HOT 7
- pytorch linear parameters calculation HOT 5
- how to run it? HOT 3
- pytorch train error HOT 1
- 1 HOT 2
- cannot import name asc_chr HOT 3
- 你好 HOT 1
- 你好,能说下你分割图片的思路吗? HOT 1
- centers = [((2*i+1)*end+(9-2*i)*begin)/10 for i in range(4)]分割语句中的这个是什么意思?多谢 HOT 1
- 我有个问题想请教一下 HOT 10
- from utils import load_single_data HOT 1
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 cnn_keras.