New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ValuerError #104
Comments
I encountered the same problems.It may be caused by the function of 'K.batch_dot()',but I don't know how to solve it. |
Thx for the reply, I take look these days |
Hey,I found a solution from brjathu/deepcaps@e273cfd . |
But that's a new project, there is no way of merging? Or crearting a pull-request? |
@gcfengxu Has this own_batch_dot been tested by training+testing on the MNIST dataset? |
@Anselmoo Sorry,I don't quite understand what you mean.I just copy the 'batchdot.py' , add it to my project,and import the file,then replace all 'K.map_fn()' with 'own_batch_dot()'. |
@data-hound Yes,I have tested it by training on the MNIST.Although the test is not completely over, it really in training. |
@gcfengxu Maybe you can once commit your version and upload it as a pull request?? I think that would help a lot. Thx |
@Anselmoo @data-hound . Sorry,I mistook the function. In my project , I replace the function: K.batch_dot() with 'own_batch_dot().Sorry for the wrong word. |
@gcfengxu Thank you very much! I got it and I would recommend the following steps:
I think it would be great if we can work together and add further test like MINST. I think that’s also the idea of open source and allows us to further modified the capsule net. The benchmark settings of this implementation looks the best and it would be sad if we cannot use it anymore. |
@Anselmoo Well, I am new to Github,I'll try your advice,thx for your suggestions! |
@gcfengxu no worries, everybody has to start 🛫 therefore we are here |
@Anselmoo @gcfengxu So, as a solution, in my implementation, I had used the K.batch_dot, and then tried to reshape it further to conform to the matrix shapes. @gcfengxu are you running the model with or without eager execution? I have ran into some problems with eager execution, and the passing of graph tensors outside the graph. This occurs just before the end of the 1st training epoch. Let me know if using this method gets you past these |
@data-hound My tensorflow version is 2.0, I never run into problems with eager execetion. But the K.batch_dot still wrong in version 2.3.1 of Keras. |
Cool. So your training and testing tasks have completed successfully using this own_batch_dot method, then @gcfengxu ? Also, as mentioned in the Keras issue I had mentioned, the behaviour of K.batch_dot will remain the same, for example,
the above code will yield shape as |
I'm using own_batch_dot it's running but I'm getting negative values for loss function after 3 or 4 epochs ! |
@uchar @Anselmoo @mrtucar @data-hound @gcfengxu I propose to replace CapsNet-Keras/capsulelayers.py Lines 120 to 163 in 9d7e641
|
Traceback (most recent call last):
File "capsulenet.py", line 310, in
routings=args.routings,
File "capsulenet.py", line 60, in CapsNet
)(primarycaps)
File "/home/Anselmoo/.local/lib/python3.6/site-packages/keras/engine/base_layer.py", line 489, in call
output = self.call(inputs, **kwargs)
File "/home/Anselmoo/GitHub-Projects/CapsNet-Keras/capsule/capsulelayers.py", line 160, in call
b += K.batch_dot(outputs, inputs_hat, [2, 3])
File "/home/Anselmoo/.local/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py", line 1499, in batch_dot
'y.shape[%d] (%d != %d).' % (axes[0], axes[1], d1, d2))
ValueError: Can not do batch_dot on inputs with shapes (None, 10, 10, 1152, 16) and (None, 10, None, 1152, 16) with axes=[2, 3]. x.shape[2] != y.shape[3] (10 != 1152).
I was running the
capsulelayers.py
with the default settings.The text was updated successfully, but these errors were encountered: