Tobias-Fischer / rt_gene

RT-GENE: Real-Time Eye Gaze and Blink Estimation in Natural Environments
http://www.imperial.ac.uk/personal-robotics
Other
368 stars 68 forks source link

Error when running estimate_gaze_standalone #80

Closed kchen003 closed 4 years ago

kchen003 commented 4 years ago

I've been trying to run the standalone file for the last few days, but I'm currently getting errors when the environment is all configured.

After I run that python2 estimate_gaze_standalone.py samples_gaze

it reports an error as follows:

Loading networks

Using device cuda:0 for face detection

Trackback(most recent call last):

File "estimate_gaze_standalone.py", line 182, in

gaze_estimator = GazeEstimator("/gpu:0", args.models)

TypeError: new() takes exactly 4 arguments(3 given)

It looks like I am just missing one argument when calling GazeEstimator.

My current configuration is Nvidia driver 450.57 CUDA 9.0 cudnn 7.3.

I'm not quite sure why this error is occurring, so hopefully, you can give me some guidance.

Tobias-Fischer commented 4 years ago

Hi @kchen003, Are you using the latest version of RT-GENE? Could you please provide the output of git status and git rev-parse HEAD? The __init__ method takes 3 arguments, so I am not sure why it reports that it takes 4 arguments (see https://github.com/Tobias-Fischer/rt_gene/blob/master/rt_gene/src/rt_gene/estimate_gaze_tensorflow.py#L12 where it's easy to see that 3 arguments [including self] should be provided).

kchen003 commented 4 years ago

I re-downloaded the latest version of rt_gene, and since I'm using python 2.7, I modified the estimate_gaze_base.py file. from abc import ABCMeta, in class GazeEstimatorBase(ABCMeta), and I do see the There are three arguments in estimate_gaze_tensorflow.py, but the error is in new(), and I see no static methods defined in the class. I'm not quite sure why this error is occurring at the moment.

Tobias-Fischer commented 4 years ago

Please post the outputs from the commands above, and additionally the output of git diff.

Tobias-Fischer commented 4 years ago

Just realized that "ABC" is not availably in python2.7; sorry for that. Please get the latest version of the code, this should work. If not, please reopen this issue.

/cc @ahmed-alhindawi

kchen003 commented 4 years ago

Thank you so much for your help, this problem has been solved. However, I am currently still getting an error after downloading all the resources in the model_nets folder.

*Traceback(most recent call last): File "estimate_gaze_standalone.py", line 182, in gaze_estimator = GazeEstimator("/gup:0", args.models) File "/home/kchen/rt_gene/rt_gene/src/rt_gene/estimate_gaze_tensorflow.py", line 16, in init tf.compat.v1.disable_eager_execution() AttributeError: 'module' object has no attribute 'v1' Exception AttributeError: "'GazeEstimator' object has no attribute 'sess'" in <bound method GazeEstimator.del of <rt_gene.estimate_gaze_tensorflow.GazeEstimator object at 07f34c500a810>> ignored**

AttributeError is usually because of the .pyc file of the source file. Should I delete the .pyc file of the estimate_gaze_tensorflow? I think the problem with GazeEstimator.del may still be due to the python version.

Tobias-Fischer commented 4 years ago

What's the output of print(tf.__version__)? Also there is a typo gup instead of gpu in your code. Do you modify anything in the code? Again please provide the output of the git commands above otherwise it is very hard to remotely debug.

kchen003 commented 4 years ago

Very sorry, typos can be ignored. I didn't change anything in the project, and the current version of my TensorFlow is 1.11.0 I first export PYTHONPATH=$HOME/rt_gene/rt_gene/src Then in the rt_gene_standalone folder python2 estimate_gaze_standalone.py samples_gaze

Tobias-Fischer commented 4 years ago

You need at least tensorflow 1.14, please upgrade it.

Tobias-Fischer commented 4 years ago

Alternatively go back to https://github.com/Tobias-Fischer/rt_gene/releases/tag/v2.2 but I wouldn't recommend doing so and would not provide any support either.

kchen003 commented 4 years ago

Thank you very much for your help, my project is up and running. But at the moment I'm still familiar with the logic and structure of the whole project. I'm only running as a standalone, but what do I need to do if I need to retrieve the eye movement data I've acquired? It's not just about outputting images. I tried to add publisher to the init of esitimate_gaze, self.coords=rospy.Publisher("/subjects/coords", String, queue_size=1). But I'm not sure where to get the data from the rospy.Subscriber that was put in before it was fetched. I haven't understand the logic for the whole project yet, and I don't know where the main function is.

Tobias-Fischer commented 4 years ago

Hi, I am a little confused by your description. You first say that you use the standalone version (i.e. without ROS), but later talk about ROS publishers. Which of the two are you using?

In the standalone version, you can get the head pose and gaze estimates here. Note that you may get multiple estimates if there are multiple people in the image, that's why there is a for loop.

For ROS, you have two options: