Open mdshopon opened 7 years ago
Could you post your error output and your tensorflow & keras versions so I can take a look at your problem?
Thank you very much for your early reply Keras Version: 2.0.2 Tensorflow Version: 1.3.0
Error:
Traceback (most recent call last): File "bangla_image_ocr.py", line 604, in <module> train(run_name, 0, 40, 128) File "bangla_image_ocr.py", line 580, in train model = Model(inputs=[input_data, labels, input_length, label_length], outputs=loss_out) File "/home/codehead/anaconda2/lib/python2.7/site-packages/keras/legacy/interfaces.py", line 88, in wrapper return func(*args, **kwargs) File "/home/codehead/anaconda2/lib/python2.7/site-packages/keras/engine/topology.py", line 1566, in __init__ if layer.is_placeholder: AttributeError: 'SpatialTransformer' object has no attribute 'is_placeholder'
Thank you, I'd try to reproduce the error using newer versions of tf and keras to see if the problem is caused by compatibility issues.
@hello2all May I know which versions did you use for this ?
If I recall correctly, tensorflow 1.0 and keras 2.0
Thanks ! Please let me know if you have found any solution for this problem .
@codeheadshopon There is a compatibility issue with the newest version of Keras. However, there is an easy fix to it: in spatia_transformer.py
, delete line 37
self.constraints = self.locnet.constraints
After deleting the line, my model was able to successfully compile with no error.
This is tested with: Tensorflow 1.3.0 Keras 2.0.8
Didn't work with me. I updated my keras version to 2.0.8 But still getting the same error.
In the newer versions of Keras, there has been an update on the method to build customized layer. Since I can not re-create the exact error you have been experiencing, I encourage you to look into the Keras documentation and modify the layer initialization accordingly.
I hope this is helpful for you.
I was trying to implement Spatial Transformer Layer in my Code but I am getting this error. Is there any solution for it ?
`
def locnet(): b = np.zeros((2, 3), dtype='float32') b[0, 0] = 1 b[1, 1] = 1 W = np.zeros((64, 6), dtype='float32') weights = [W, b.flatten()] locnet = Sequential()