Closed vandana-rajan closed 6 years ago
@vandana-rajan We use model.fit(X,Y)
to train a one-in-one-out model and model.fit([X1,X2], [Y1,Y2])
to train two-in-two-out model. The Capsnet model two-in-two-out, so the inputs=[X1,X2]=[x_train, y_train] and the outputs (also the targets)=[Y1,Y2]=[y_train,x_train].
Please refer to https://keras.io/getting-started/functional-api-guide/#multi-input-and-multi-output-models for more details.
@XifengGuo
Okay. I went through the link and kind of understood multi-input-multi-output models in Keras. But where exactly in capsnet is this 2-input stage coming? As I understand it, the architecture of capsnet is like this,
Input->conv2d layer->primary caps->digitcaps->FCN1->FCN2->FCN3
Can you tell me where in the code can I observe this 2-input/2-output stage? (In the code provided in the link that you gave, keras.layers.concatenate tells the point where 2 inputs meet).
Apologies for these might-be-silly questions.
@vandana-rajan I was stuck in this issue too. So far what I understand is that the capsnet model is predicting a label and a reconstructed image - two outputs which have different loss functions. If you look at the result/model.png, you can see there are two inputs input_1 and input_2 and two outputs decoder_sequential and capsnet, hence two-in-two-out model
okay. I understood it now. Thanks @XifengGuo and @JoyJulianGomes
In the 'train' function, why is data given as [x,y],[y,x]? For example,
I am new to Keras framework. Please help me understand why data is given like this.