Mask_RCNN
Mask_RCNN copied to clipboard
Tensorflow / Keras Google Colab dependency problems `AttributeError: module 'tensorflow._api.v1.compat.v2' has no attribute '__internal__'`
I have running a MASK RCNN Model with tensorflow 1.15 and keras 2.1.6 every thing worked correctly but today when I want to run it again I get this error "module 'tensorflow._api.v1.compat.v2' has no attribute 'internal'"
Even I am facing the same problem, the code was working fine yesterday but today for some reason Google Colab gives this error
Even I am facing the same problem, the code was working fine yesterday but today for some reason Google Colab gives this error
Hello @aaronadb if you find a solution inform me please I will appreciate your help
Me to facing the same issue......
I have the same problem.
I have the same problem from yesterday and I have not found any solution.
I have the same problem from yesterday and I have not found any solution.
Me too I didn't find a solution, I am blocked :/
I've got the same problem. Yesterday no problem, today this error, without making changes to the code. Thanks
I've got the same problem. Yesterday no problem, today this error, without making changes to the code. Thanks
The same problem yesterday everything is Ok, but today I can't run mun code I am looking to find a solution
Hi guys, I have the same issue. I managed to find out what happens but it's unsuccessful. When I try to do with various versions of Keras and TensorFlow, I get different error announcements. Have you fixed? Please let me know. Thanks a lot.
Guys I am tried with in build tensorflow/magic function of tensorflow 1x with different versions of keras but ended with some errors...If it is fixed please let us know
same here :(
I don't know this issue comes from Keras, TF or Colab, or whatever
I tried to run my code on my machine, same error. so I think the issue hasn't caused by colab
I solved the problem when I try to :
!pip uninstall keras-nightly pip uninstall -y tensorflow
and then install tensorflow and kerass with version you want to use
I solved the problem when I try to :
!pip uninstall keras-nightly pip uninstall -y tensorflow
and then install tensorflow and kerass with version you want to use
could you please share keras and tensorflow version that you are using?
I solved the problem when I try to : !pip uninstall keras-nightly pip uninstall -y tensorflow and then install tensorflow and kerass with version you want to use
could you please share keras and tensorflow version that you are using?
pip install tensorflow-gpu==1.15.0 pip install keras==2.1.6
After Uninstalling using
!pip uninstall keras-nightly !pip uninstall -y tensorflow
and Installing my required versions tensorflow == 1.15.0 and keras == 2.2.5 , while training i got below error
**Traceback (most recent call last):
File "beagle.py", line 397, in
<ctrl+b>AttributeError: 'str' object has no attribute 'decode'** <ctrl+b>
<ctrl+b>..................More details of error are below...............<ctrl+b>
Using TensorFlow backend. Weights: coco Dataset: beagle Logs: /content/logs
Configurations: BACKBONE resnet101 BACKBONE_STRIDES [4, 8, 16, 32, 64] BATCH_SIZE 2 BBOX_STD_DEV [0.1 0.1 0.2 0.2] COMPUTE_BACKBONE_SHAPE None DETECTION_MAX_INSTANCES 100 DETECTION_MIN_CONFIDENCE 0.9 DETECTION_NMS_THRESHOLD 0.3 FPN_CLASSIF_FC_LAYERS_SIZE 1024 GPU_COUNT 1 GRADIENT_CLIP_NORM 5.0 IMAGES_PER_GPU 2 IMAGE_CHANNEL_COUNT 3 IMAGE_MAX_DIM 1024 IMAGE_META_SIZE 19 IMAGE_MIN_DIM 800 IMAGE_MIN_SCALE 0 IMAGE_RESIZE_MODE square IMAGE_SHAPE [1024 1024 3] LEARNING_MOMENTUM 0.9 LEARNING_RATE 0.001 LOSS_WEIGHTS {'rpn_class_loss': 1.0, 'rpn_bbox_loss': 1.0, 'mrcnn_class_loss': 1.0, 'mrcnn_bbox_loss': 1.0, 'mrcnn_mask_loss': 1.0} MASK_POOL_SIZE 14 MASK_SHAPE [28, 28] MAX_GT_INSTANCES 100 MEAN_PIXEL [123.7 116.8 103.9] MINI_MASK_SHAPE (56, 56) NAME beagle NUM_CLASSES 7 POOL_SIZE 7 POST_NMS_ROIS_INFERENCE 1000 POST_NMS_ROIS_TRAINING 2000 PRE_NMS_LIMIT 6000 ROI_POSITIVE_RATIO 0.33 RPN_ANCHOR_RATIOS [0.5, 1, 2] RPN_ANCHOR_SCALES (32, 64, 128, 256, 512) RPN_ANCHOR_STRIDE 1 RPN_BBOX_STD_DEV [0.1 0.1 0.2 0.2] RPN_NMS_THRESHOLD 0.7 RPN_TRAIN_ANCHORS_PER_IMAGE 256 STEPS_PER_EPOCH 100 TOP_DOWN_PYRAMID_SIZE 256 TRAIN_BN False TRAIN_ROIS_PER_IMAGE 200 USE_MINI_MASK True USE_RPN_ROIS True VALIDATION_STEPS 50 WEIGHT_DECAY 0.0001
WARNING:tensorflow:From /usr/local/lib/python3.7/dist-packages/keras/backend/tensorflow_backend.py:541: The name tf.placeholder is deprecated. Please use tf.compat.v1.placeholder instead.
WARNING:tensorflow:From /usr/local/lib/python3.7/dist-packages/keras/backend/tensorflow_backend.py:66: The name tf.get_default_graph is deprecated. Please use tf.compat.v1.get_default_graph instead.
WARNING:tensorflow:From /usr/local/lib/python3.7/dist-packages/keras/backend/tensorflow_backend.py:4432: The name tf.random_uniform is deprecated. Please use tf.random.uniform instead.
WARNING:tensorflow:From /usr/local/lib/python3.7/dist-packages/keras/backend/tensorflow_backend.py:2139: The name tf.nn.fused_batch_norm is deprecated. Please use tf.compat.v1.nn.fused_batch_norm instead.
WARNING:tensorflow:From /usr/local/lib/python3.7/dist-packages/keras/backend/tensorflow_backend.py:4267: The name tf.nn.max_pool is deprecated. Please use tf.nn.max_pool2d instead.
WARNING:tensorflow:From /usr/local/lib/python3.7/dist-packages/keras/backend/tensorflow_backend.py:2239: The name tf.image.resize_nearest_neighbor is deprecated. Please use tf.compat.v1.image.resize_nearest_neighbor instead.
WARNING:tensorflow:From /usr/local/lib/python3.7/dist-packages/tensorflow_core/python/ops/array_ops.py:1475: where (from tensorflow.python.ops.array_ops) is deprecated and will be removed in a future version. Instructions for updating: Use tf.where in 2.0, which has the same broadcast rule as np.where WARNING:tensorflow:From /usr/local/lib/python3.7/dist-packages/mask_rcnn-2.1-py3.7.egg/mrcnn/model.py:553: The name tf.random_shuffle is deprecated. Please use tf.random.shuffle instead.
WARNING:tensorflow:From /usr/local/lib/python3.7/dist-packages/mask_rcnn-2.1-py3.7.egg/mrcnn/utils.py:202: The name tf.log is deprecated. Please use tf.math.log instead.
WARNING:tensorflow:From /usr/local/lib/python3.7/dist-packages/mask_rcnn-2.1-py3.7.egg/mrcnn/model.py:600: calling crop_and_resize_v1 (from tensorflow.python.ops.image_ops_impl) with box_ind is deprecated and will be removed in a future version.
Instructions for updating:
box_ind is deprecated, use box_indices instead
Downloading pretrained model to /content/mask_rcnn_coco.h5 ...
... done downloading pretrained model!
Loading weights /content/mask_rcnn_coco.h5
Traceback (most recent call last):
File "beagle.py", line 397, in
After Uninstalling using
!pip uninstall keras-nightly !pip uninstall -y tensorflow
and Installing my required versions tensorflow == 1.15.0 and keras == 2.2.5 , while training i got below error
**Traceback (most recent call last): File "beagle.py", line 397, in "mrcnn_bbox", "mrcnn_mask"]) File "/usr/local/lib/python3.7/dist-packages/mask_rcnn-2.1-py3.7.egg/mrcnn/model.py", line 2130, in load_weights File "/usr/local/lib/python3.7/dist-packages/keras/engine/saving.py", line 1224, in load_weights_from_hdf5_group_by_name original_keras_version = f.attrs['keras_version'].decode('utf8')
<ctrl+b>AttributeError: 'str' object has no attribute 'decode'** <ctrl+b>
<ctrl+b>..................More details of error are below...............<ctrl+b>
Using TensorFlow backend. Weights: coco Dataset: beagle Logs: /content/logs
Configurations: BACKBONE resnet101 BACKBONE_STRIDES [4, 8, 16, 32, 64] BATCH_SIZE 2 BBOX_STD_DEV [0.1 0.1 0.2 0.2] COMPUTE_BACKBONE_SHAPE None DETECTION_MAX_INSTANCES 100 DETECTION_MIN_CONFIDENCE 0.9 DETECTION_NMS_THRESHOLD 0.3 FPN_CLASSIF_FC_LAYERS_SIZE 1024 GPU_COUNT 1 GRADIENT_CLIP_NORM 5.0 IMAGES_PER_GPU 2 IMAGE_CHANNEL_COUNT 3 IMAGE_MAX_DIM 1024 IMAGE_META_SIZE 19 IMAGE_MIN_DIM 800 IMAGE_MIN_SCALE 0 IMAGE_RESIZE_MODE square IMAGE_SHAPE [1024 1024 3] LEARNING_MOMENTUM 0.9 LEARNING_RATE 0.001 LOSS_WEIGHTS {'rpn_class_loss': 1.0, 'rpn_bbox_loss': 1.0, 'mrcnn_class_loss': 1.0, 'mrcnn_bbox_loss': 1.0, 'mrcnn_mask_loss': 1.0} MASK_POOL_SIZE 14 MASK_SHAPE [28, 28] MAX_GT_INSTANCES 100 MEAN_PIXEL [123.7 116.8 103.9] MINI_MASK_SHAPE (56, 56) NAME beagle NUM_CLASSES 7 POOL_SIZE 7 POST_NMS_ROIS_INFERENCE 1000 POST_NMS_ROIS_TRAINING 2000 PRE_NMS_LIMIT 6000 ROI_POSITIVE_RATIO 0.33 RPN_ANCHOR_RATIOS [0.5, 1, 2] RPN_ANCHOR_SCALES (32, 64, 128, 256, 512) RPN_ANCHOR_STRIDE 1 RPN_BBOX_STD_DEV [0.1 0.1 0.2 0.2] RPN_NMS_THRESHOLD 0.7 RPN_TRAIN_ANCHORS_PER_IMAGE 256 STEPS_PER_EPOCH 100 TOP_DOWN_PYRAMID_SIZE 256 TRAIN_BN False TRAIN_ROIS_PER_IMAGE 200 USE_MINI_MASK True USE_RPN_ROIS True VALIDATION_STEPS 50 WEIGHT_DECAY 0.0001
WARNING:tensorflow:From /usr/local/lib/python3.7/dist-packages/keras/backend/tensorflow_backend.py:541: The name tf.placeholder is deprecated. Please use tf.compat.v1.placeholder instead.
WARNING:tensorflow:From /usr/local/lib/python3.7/dist-packages/keras/backend/tensorflow_backend.py:66: The name tf.get_default_graph is deprecated. Please use tf.compat.v1.get_default_graph instead.
WARNING:tensorflow:From /usr/local/lib/python3.7/dist-packages/keras/backend/tensorflow_backend.py:4432: The name tf.random_uniform is deprecated. Please use tf.random.uniform instead.
WARNING:tensorflow:From /usr/local/lib/python3.7/dist-packages/keras/backend/tensorflow_backend.py:2139: The name tf.nn.fused_batch_norm is deprecated. Please use tf.compat.v1.nn.fused_batch_norm instead.
WARNING:tensorflow:From /usr/local/lib/python3.7/dist-packages/keras/backend/tensorflow_backend.py:4267: The name tf.nn.max_pool is deprecated. Please use tf.nn.max_pool2d instead.
WARNING:tensorflow:From /usr/local/lib/python3.7/dist-packages/keras/backend/tensorflow_backend.py:2239: The name tf.image.resize_nearest_neighbor is deprecated. Please use tf.compat.v1.image.resize_nearest_neighbor instead.
WARNING:tensorflow:From /usr/local/lib/python3.7/dist-packages/tensorflow_core/python/ops/array_ops.py:1475: where (from tensorflow.python.ops.array_ops) is deprecated and will be removed in a future version. Instructions for updating: Use tf.where in 2.0, which has the same broadcast rule as np.where WARNING:tensorflow:From /usr/local/lib/python3.7/dist-packages/mask_rcnn-2.1-py3.7.egg/mrcnn/model.py:553: The name tf.random_shuffle is deprecated. Please use tf.random.shuffle instead.
WARNING:tensorflow:From /usr/local/lib/python3.7/dist-packages/mask_rcnn-2.1-py3.7.egg/mrcnn/utils.py:202: The name tf.log is deprecated. Please use tf.math.log instead.
WARNING:tensorflow:From /usr/local/lib/python3.7/dist-packages/mask_rcnn-2.1-py3.7.egg/mrcnn/model.py:600: calling crop_and_resize_v1 (from tensorflow.python.ops.image_ops_impl) with box_ind is deprecated and will be removed in a future version. Instructions for updating: box_ind is deprecated, use box_indices instead Downloading pretrained model to /content/mask_rcnn_coco.h5 ... ... done downloading pretrained model! Loading weights /content/mask_rcnn_coco.h5 Traceback (most recent call last): File "beagle.py", line 397, in "mrcnn_bbox", "mrcnn_mask"]) File "/usr/local/lib/python3.7/dist-packages/mask_rcnn-2.1-py3.7.egg/mrcnn/model.py", line 2130, in load_weights File "/usr/local/lib/python3.7/dist-packages/keras/engine/saving.py", line 1224, in load_weights_from_hdf5_group_by_name original_keras_version = f.attrs['keras_version'].decode('utf8') AttributeError: 'str' object has no attribute 'decode'
try with keras 2.1.6
@bhsnada
The same issue repeats again after using keras 2.1.6
Traceback (most recent call last):
File "beagle.py", line 397, in
@peppyguy, Could you detail it? only downgrading h5py or anything else? Thanks
I solved the problem when I try to : !pip uninstall keras-nightly pip uninstall -y tensorflow and then install tensorflow and kerass with version you want to use
could you please share keras and tensorflow version that you are using?
pip install tensorflow-gpu==1.15.0 pip install keras==2.1.6
thanks a lot! worked for me.
@peppyguy, Could you detail it? only downgrading h5py or anything else? Thanks
After following the steps suggested by @bhsnada , I downgraded the version of h5py to 2.10.0 then it works Thanks @bhsnada
Thank you so much, @peppyguy and @bhsnada Now it works fine
If you don't use tensorflow-gpu, try this tensorflow 1.14, keras 2.1.5 and h5py 2.10.0 (works for me)
I solved the problem when I try to :
!pip uninstall keras-nightly pip uninstall -y tensorflow
and then install tensorflow and kerass with version you want to use
Fixed, for me! I added: !pip uninstall h5py !pip install h5py==2.10.0
Thanks so much
!pip uninstall keras-nightly
!pip install h5py==2.10.0
I added this to the top of my code and the problem is now solved
I added the code below in the beginning part and !pip uninstall keras-nightly !pip install h5py==2.10.0 then !pip uninstall keras-nightly !pip uninstall keras then !pip install keras==2.1.6 %tensorflow_version 1.x #this version is for google colab and then probem is solved
Hello, I also faced the same problem. But I got stuck when unstalling keras-nighty on colab. What to type on colab?
- --yes
- -y 3)y
Thanks in advance.
Hello, I also faced the same problem. But I got stuck when unstalling keras-nighty on colab. What to type on colab?
- --yes
- -y 3)y
Thanks in advance.
just type y and click enter
@denashamss yes I type y but it didn't work. or it takes much time?