[PYTHON] AttributeError: The story of solving module'tensorflow' has no attribute'log'.

* Added on 2020/05/18

The article below introduces a new solution!

The story of downgrading the version of tensorflow in the demo of Mask R-CNN.

I wanted to implement Mask R-CNN

** Deep learning super beginner ** is the story that solved the error. I wrote an article in the hope that it would help someone.

If you want to use Mask R-CNN for image recognition, the shortcut is to use the code Mask_RCNN from matterport.

https://github.com/matterport/Mask_RCNN

I didn't understand even after reading this much, so while reading the following site, I tried to run demo.ipynb on Google cola boratory.

https://tech-blog.optim.co.jp/entry/2019/03/28/173000 http://maruo51.com/2020/02/22/mrcnn/

However! Even if you try to execute it as it is

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

Will occur. (As of April 20, 2020)

So, I tried and errored for about two days to solve this, so I will write it down.

Solution (provisional)

The reference is like the trouble consultation box on github shown below.

https://github.com/matterport/Mask_RCNN/issues/1797#

It's all in English, but when I tried my best to read it, I found a post that would give me a hint.

tf.log() -> tf.math.log()
tf.sets.set_intersection() -> tf.sets.intersection()
tf.sparse_tensor_to_dense() -> tf.sparse.to_dense()
tf.to_float() -> tf.cast([value], tf.float32)

Apparently, it seems to be an error caused by a different version of tensorflow and a changed method.

You should rewrite the relevant part of mrcnn / model.py exactly like this.

important point!

It should be noted that instead of going to the end of the error and then modifying model.py ** Rewriting model.py immediately after first cloning the repository **.

** It seems that it was solved by proceeding with setup etc. in the modified model.py **. (Somehow, I think it's a makeshift solution, so If anyone knows the real cause, please let me know. )

case being settled! I hope you find it helpful!

Recommended Posts

AttributeError: The story of solving module'tensorflow' has no attribute'log'.
The story of sys.path.append ()
The story of building Zabbix 4.4
[Apache] The story of prefork
The story of Python and the story of NaN
The story of participating in AtCoder
The story of the "hole" in the file
Solving the amplitude of interferometer observations
The story of remounting the application server
The story of writing a program
Solving the phase of interferometer observations
The story of trying to reconnect the client
The story of an error in PyOCR
The story of verifying the open data of COVID-19
The story of adding MeCab to ubuntu 16.04
The story of making Python an exe
The story of manipulating python global variables
The usage of TensorBoard has changed slightly
The story of deciphering Keras' LSTM model.predict
The story of blackjack A processing (python)
Solving the complex gain of interferometer observations
A story made by a person who has no knowledge of Python or Json
The story of doing deep learning with TPU
The story of low learning costs for Python
AttributeError: module'urllib' has no attribute'request' error in urllib.request
The story of making the Mel Icon Generator version2
Image processing? The story of starting Python for
The story of making a lie news generator
The story of finding the optimal n in N fist
The story of misreading the swap line of the top command
AttributeError: module ‘torch.utils’ has no attribute ‘data’ solution
The story of reading HSPICE data in Python
Solving the equation of motion in Python (odeint)
The story of viewing media files in Django
The story of making a mel icon generator
[Small story] Download the image of Ghibli immediately
The story of moving from Pipenv to Poetry
TensorFlow runtime Attribute Error: module'tensorflow' has no attribute'constant' is the first thing to doubt