PacktPublishing / Deep-Learning-for-Computer-Vision

Deep Learning for Computer Vision, by Packt
MIT License
213 stars 167 forks source link

3_satellite from Chapter 5 #3

Closed shirll closed 3 years ago

shirll commented 5 years ago

Dear author,

I have encountered an error when running your code for modelling FCN for segmentation.

Traceback (most recent call last): File "d:\git\Deep-Learning-for-Computer-Vision\Chapter05\3_satellite.py", line 14, in <module> resnet50_model = ResNet50(include_top=False, weights='imagenet', input_tensor=input_tensor) File "C:\Users\gesu270495\AppData\Local\Programs\Python\Python36\lib\site-packages\keras_applications\resnet50.py", line 212, in ResNet50 x = layers.ZeroPadding2D(padding=(3, 3), name='conv1_pad')(img_input) File "C:\Users\gesu270495\AppData\Local\Programs\Python\Python36\lib\site-packages\keras\engine\base_layer.py", line 446, in __call__ previous_mask = _collect_previous_mask(inputs) File "C:\Users\gesu270495\AppData\Local\Programs\Python\Python36\lib\site-packages\keras\engine\base_layer.py", line 1328, in _collect_previous_mask mask = node.output_masks[tensor_index] AttributeError: 'Node' object has no attribute 'output_masks'

So far, I haven't been able to fix it. Any suggestions about what might cause this error would help.

Best Regards,

Shirll

sotoglzz commented 5 years ago

Hi Shirll, I had the same issue, replace:

input_shape = [512, 512, 3]
input_tensor = tf.keras.layers.Input(shape=input_shape)
resnet50_model = ResNet50(include_top=False, 
                                       weights=weights, 
                                           input_tensor=input_tensor)

with this:

resnet50_model = ResNet50(include_top=False, 
                                       weights=weights, 
                                           input_shape=input_shape)

That worked to me.

sotoglzz commented 5 years ago

Also, if you want to replicate the results from 3_satellite.py, you should see this post:

https://www.azavea.com/blog/2017/05/30/deep-learning-on-aerial-imagery/

They provided a link to github with all the source codes. With some modifications you should be able to compile the model

Regards