Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cnn_head_pose estimation: module 'tensorflow' has no attribute 'placeholder' #102

Open
bensalahmara opened this issue Sep 30, 2020 · 7 comments

Comments

@bensalahmara
Copy link

hi @mpatacchiola
i try to run the head pose estimation example but it give me un error that t cant solve it i hope that you can help me:
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
import cv2
from deepgaze.head_pose_estimation import CnnHeadPoseEstimator
sess =tf.compat.v1.Session() #Launch the graph in a session.
my_head_pose_estimator = CnnHeadPoseEstimator(sess) #Head pose estimation object
my_head_pose_estimator.load_pitch_variables("../../etc/tensorflow/head_pose/pitch/cnn_cccdd_30k.tf")
for i in range(1,9):
file_name = str(i) + ".jpg"
print("Processing image ..... " + file_name)
image = cv2.imread(file_name) #Read the image with OpenCV
pitch = my_head_pose_estimator.return_pitch(image) #Evaluate the pitch angle using a CNN
print("Estimated pitch ..... " + str(pitch[0,0,0]))
print("")
=>AttributeError Traceback (most recent call last)
in ()
5 sess =tf.compat.v1.Session() #Launch the graph in a session.
6 my_head_pose_estimator = CnnHeadPoseEstimator(sess) #Head pose estimation object
----> 7 my_head_pose_estimator.load_pitch_variables("../../etc/tensorflow/head_pose/pitch/cnn_cccdd_30k.tf")
8 for i in range(1,9):
9 file_name = str(i) + ".jpg"

1 frames
/content/gdrive/My Drive/deepgaze/deepgaze/head_pose_estimation.py in _allocate_pitch_variables(self)
231 self._num_labels = 1
232 # Input data [batch_size, image_size, image_size, channels]
--> 233 self.tf_pitch_input_vector = tf.placeholder(tf.float32, shape=(64, 64, 3))
234
235 # Variables.

AttributeError: module 'tensorflow' has no attribute 'placeholder'
note: the version of tensorflow that i use it is:(2.3.0)
what version of tensorflow shoud i reinstall,??

@kamathhrishi
Copy link

Hey , below tensor flow 2.0 would do. Tensor flow 2.0 support isn't there yet.

@kamathhrishi
Copy link

Stay updated for the same.

@bensalahmara
Copy link
Author

hi @kamathhrishi
i dont undrestand you
would you mind explain me more how can i handle this error

@kamathhrishi
Copy link

Downgrade to Tensor flow 1.14

@bensalahmara
Copy link
Author

should i uninstall the version that i have first ?

@kamathhrishi
Copy link

kamathhrishi commented Oct 2, 2020

Yeah you would have to do that or run deepgaze in a seperate conda environment or virtual env.

@ProgramComputer
Copy link

ProgramComputer commented Sep 18, 2023

ProgramComputer/deepgaze-tfv2
I converted to tf.compat.v1 for Tensorflow 2.0.
Make sure eager execution is off before using tf.compat.v1.disable_eager_execution().
`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants