Mask_RCNN icon indicating copy to clipboard operation
Mask_RCNN copied to clipboard

AttributeError: module 'tensorflow' has no attribute 'placeholder'

Open Sayan-Dexter opened this issue 4 years ago • 1 comments

ERROR SHOWS LIKE THIS: PLEASE HELP ME IN THIS I GOT STUCK IN IT:-

AttributeError Traceback (most recent call last) in ----> 1 model = modellib.MaskRCNN( 2 mode='training', 3 config=config, 4 model_dir=DEFAULT_LOGS_DIR 5 )

C:\ANACONDA\mrcnn\model.py in init(self, mode, config, model_dir) 1835 self.model_dir = model_dir 1836 self.set_log_dir() -> 1837 self.keras_model = self.build(mode=mode, config=config) 1838 1839 def build(self, mode, config):

C:\ANACONDA\mrcnn\model.py in build(self, mode, config) 1853 1854 # Inputs -> 1855 input_image = KL.Input( 1856 shape=[None, None, config.IMAGE_SHAPE[2]], name="input_image") 1857 input_image_meta = KL.Input(shape=[config.IMAGE_META_SIZE],

C:\ANACONDA\lib\site-packages\keras\engine\topology.py in Input(shape, batch_shape, name, dtype, sparse, tensor) 1452 if not dtype: 1453 dtype = K.floatx() -> 1454 input_layer = InputLayer(batch_input_shape=batch_shape, 1455 name=name, dtype=dtype, 1456 sparse=sparse,

C:\ANACONDA\lib\site-packages\keras\legacy\interfaces.py in wrapper(*args, **kwargs) 89 warnings.warn('Update your ' + object_name + 90 ' call to the Keras 2 API: ' + signature, stacklevel=2) ---> 91 return func(*args, **kwargs) 92 wrapper._original_function = func 93 return wrapper

C:\ANACONDA\lib\site-packages\keras\engine\topology.py in init(self, input_shape, batch_size, batch_input_shape, dtype, input_tensor, sparse, name) 1361 if input_tensor is None: 1362 self.is_placeholder = True -> 1363 input_tensor = K.placeholder(shape=batch_input_shape, 1364 dtype=dtype, 1365 sparse=self.sparse,

C:\ANACONDA\lib\site-packages\keras\backend\tensorflow_backend.py in placeholder(shape, ndim, dtype, sparse, name) 505 x = tf.sparse_placeholder(dtype, shape=shape, name=name) 506 else: --> 507 x = tf.placeholder(dtype, shape=shape, name=name) 508 x._keras_shape = shape 509 x._uses_learning_phase = False

AttributeError: module 'tensorflow' has no attribute 'placeholder'

AND MY CODE WAS:-

model = modellib.MaskRCNN( mode='training', config=config, model_dir=DEFAULT_LOGS_DIR )

model.load_weights( COCO_MODEL_PATH, by_name=True, exclude=["mrcnn_class_logits", "mrcnn_bbox_fc", "mrcnn_bbox", "mrcnn_mask"] )

Sayan-Dexter avatar Jun 09 '21 18:06 Sayan-Dexter

Even I am facing the same issue. Have you resolved it by any chance? And which Tensorflow version are you using?

poornima2605 avatar Aug 23 '22 12:08 poornima2605