RoomNet icon indicating copy to clipboard operation
RoomNet copied to clipboard

Adapt to the new tensorflow version

Open PositivPy opened this issue 3 years ago • 0 comments

Error

The new tensorflow version (2.0) has a different API;

Traceback (most recent call last):
  File "app.py", line 21, in <module>
    nn = RoomNet(num_classes=len(CLASS_LABELS), im_side=IMG_SIDE, compute_bn_mean_var=False,
  File "/RoomNet/network.py", line 28, in __init__
    self.x_tensor = tf.placeholder(tf.float32, shape=[None, im_side, im_side, 3],
AttributeError: module 'tensorflow' has no attribute 'placeholder'

Solution

In ./network.py replace the tensorflow import with;

import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()

PositivPy avatar Jan 01 '22 04:01 PositivPy