Open Jan-No opened 5 years ago
I think the fix is as simple as just modifying line 178 to:
in_channels = inputs.shape[-1]
Please let me know if this fix is valid.
If you want to use it in tensorflow 2, I suggest changing
in_channels = inputs.shape[-1].value to in_channels = inputs.shape.as_list()[-1]
It works good ! @Datadote
Hello! I'm getting the same error as you, but both the solutions @Datadote and @Jan-No proposed aren't working for me. The only difference of my environment is my tensorflow version, which is 2.4.0. Any idea?
I found a solution that worked for me.
For this problem, keep code statement as it is ( in_channels = inputs.shape[-1].value ).
Install below versions.
If you are trying for tensorflow==2.4.0. I have not tried it but i doubt that its because of keras version.
If Datadote's solution doesn't work. Maybe you can try just removing ".value" .
If you want to use it in tensorflow 2, I suggest changing
in_channels = inputs.shape[-1].value to in_channels = inputs.shape.as_list()[-1]
This worked in TF 2.7.
Hello! I'm getting the same error as you, but both the solutions @Datadote and @Jan-No proposed aren't working for me. The only difference of my environment is my tensorflow version, which is 2.4.0. Any idea?
Use tensorflow==2.7.0 and keras==2.7.0
and also edit the file
changes..
in_channels = inputs.shape[-1].value
to
in_channels = inputs.shape.as_list()[-1]
Hi,
I just found the project and was very eager to try it. However, if I want to create the model with:
`import segmentation_models as sm from model import Deeplabv3
`
I get an error:
Traceback (most recent call last): File "D:/Documents/road_detection/workspace_new/deeplab-v3-plus/Model.py", line 64, in <module> deeplab_model = Deeplabv3(input_shape=(256, 256, 3), classes=1) File "D:\Documents\road_detection\workspace_new\deeplab-v3-plus\deeplab_model.py", line 328, in Deeplabv3 expansion=1, block_id=0, skip_connection=False) File "D:\Documents\road_detection\workspace_new\deeplab-v3-plus\deeplab_model.py", line 178, in _inverted_res_block in_channels = inputs.shape[-1].value # inputs._keras_shape[-1] AttributeError: 'int' object has no attribute 'value'
What am I doing wrong? I am using
tensorflow-gpu 2.0.0
and other models compile fine.Thanks for input.
Best,
Jan