charlesq34 / pointnet

PointNet: Deep Learning on Point Sets for 3D Classification and Segmentation
Other
4.64k stars 1.45k forks source link

pointclouds_pl = tf.placeholder(tf.float32, shape=(batch_size, num_point, 3)) AttributeError: module 'tensorflow' has no attribute 'placeholder' #265

Closed monacv closed 3 years ago

monacv commented 3 years ago
[3306:3298 0:1022] 01:57:24 Tue Dec 29 [mona@goku:pts/0 +1] ~/research/code/DJ-RN/pointnet
$ python train.py 
Traceback (most recent call last):
  File "train.py", line 260, in <module>
    train()
  File "train.py", line 96, in train
    pointclouds_pl, labels_pl = MODEL.placeholder_inputs(BATCH_SIZE, NUM_POINT)
  File "/home/mona/research/code/DJ-RN/pointnet/models/pointnet_cls.py", line 13, in placeholder_inputs
    pointclouds_pl = tf.placeholder(tf.float32, shape=(batch_size, num_point, 3))
AttributeError: module 'tensorflow' has no attribute 'placeholder'

Also:

[3306:3298 0:1023] 01:57:31 Tue Dec 29 [mona@goku:pts/0 +1] ~/research/code/DJ-RN/pointnet
$ python
Python 3.8.5 (default, Sep  4 2020, 07:30:14) 
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
>>> tf.__version__
'2.2.0'
>>> quit()
12149/31772MB
[3306:3298 0:1024] 01:59:05 Tue Dec 29 [mona@goku:pts/0 +1] ~/research/code/DJ-RN/pointnet
$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Sun_Jul_28_19:07:16_PDT_2019
Cuda compilation tools, release 10.1, V10.1.243
12149/31772MB

$ lsb_release -a
LSB Version:    core-11.1.0ubuntu2-noarch:security-11.1.0ubuntu2-noarch
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.1 LTS
Release:    20.04
Codename:   focal
monacv commented 3 years ago

https://stackoverflow.com/questions/65497808/execution-of-tf1-x-code-with-tf2-2-causes-errors

used

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

instead of

import tensorflow as tf

and then use it like:

tf.placeholder()

e.g.,

pointclouds_ph = tf.placeholder(tf.float32, shape=(batch_size, point_num, 3))
ineedhelpplsss commented 2 years ago

same issue, i tried your suggestion but it doesn't work for me. where do i need to apply the changes? is it just to the training.py and model.py?