titu1994 / keras-coordconv

Keras implementation of CoordConv for all Convolution layers
MIT License
148 stars 33 forks source link

Version of the requirement of python package, especially tensorflow. #17

Closed Annie98 closed 4 years ago

Annie98 commented 4 years ago

can you just list the version of the requriement of python packages, especially tensorflow?

titu1994 commented 4 years ago

Tensorflow 1.12+ should be fine. Not tested with 2.0, but latest Keras from pypi does support Tensorflow 2 so I expect it to work.

Annie98 commented 4 years ago

Many thanks for your replying. I use tensorflow 1.15.0 and keras 2.3.1, but with the problem as follow: /home/anni/anaconda3/lib/python3.6/site-packages/h5py/init.py:36: FutureWarning: Conversion of the second argument of issubdtype from float to np.floating is deprecated. In future, it will be treated as np.float64 == np.dtype(float).type. from ._conv import register_converters as _register_converters Using TensorFlow backend. Traceback (most recent call last): File "/home/anni/code/Contouring/Code/Models/coordUnet.py", line 119, in m = cdunet(5, 256, 256) File "/home/anni/code/Contouring/Code/Models/coordUnet.py", line 16, in cdunet x = CoordinateChannel2D()(img_input) File "/home/anni/anaconda3/lib/python3.6/site-packages/tensorflow_core/python/keras/engine/base_layer.py", line 881, in call inputs, outputs, args, kwargs) File "/home/anni/anaconda3/lib/python3.6/site-packages/tensorflow_core/python/keras/engine/base_layer.py", line 2043, in _set_connectivitymetadata input_tensors=inputs, output_tensors=outputs, arguments=arguments) File "/home/anni/anaconda3/lib/python3.6/site-packages/tensorflow_core/python/keras/engine/base_layer.py", line 2059, in _add_inbound_node input_tensors) File "/home/anni/anaconda3/lib/python3.6/site-packages/tensorflow_core/python/util/nest.py", line 536, in map_structure structure[0], [func(x) for x in entries], File "/home/anni/anaconda3/lib/python3.6/site-packages/tensorflow_core/python/util/nest.py", line 536, in structure[0], [func(x) for x in entries], File "/home/anni/anaconda3/lib/python3.6/site-packages/tensorflow_core/python/keras/engine/base_layer.py", line 2058, in inbound_layers = nest.map_structure(lambda t: t._keras_history.layer, AttributeError: 'tuple' object has no attribute 'layer' And this is my code: ` from keras.models import Model from keras.applications import vgg16 from keras.layers import Input, BatchNormalization, Activation, concatenate from keras.layers import Conv2D, UpSampling2D, MaxPooling2D import sys sys.path.append('../') from coord import CoordinateChannel2D

def cdunet(nClasses, input_height, input_width): img_input = Input(shape=(input_height, input_width, 1)) x = CoordinateChannel2D()(img_input) ft = Conv2D(filters=3, kernel_size=3, padding='same', kernel_initializer='glorot_normal', bias_initializer='zeros' )(x) md = Model(inputs=img_input, outputs=ft) vgg_streamlined = vgg16.VGG16(include_top=False, weights=None, input_tensor=md.output) assert isinstance(vgg_streamlined, Model) ...... ` I also try the version of tensorflow such as 1.13.2 ,1.14.0 and 1.12.0, but all of those have some problem. Could you help me? Thank you !

titu1994 commented 4 years ago

I don't know what the issue is here. Seems internally Keras error somewhere. I've stopped working with base Keras, and have just been moving stuff to TF.keras as an alternative.

If you'd like I could probably port this module to tf.keras instead.

Annie98 commented 4 years ago

Thanks, and Good Luck!