yihuacheng / GazeTR

The codes and models in 'Gaze Estimation using Transformer, ICPR2022'.
116 stars 21 forks source link

How to draw the red arrow? #2

Open sukun1045 opened 3 years ago

sukun1045 commented 3 years ago

Hi, thanks for the nice and clean repo. I have two questions here.

1. I am trying to use your code on my own images for other purposes. Since there is no ground truth available, I am wondering whether you could provide the code to draw the red line as you show in the paper figure so that I could approximately evaluate the performance.

2. For my own images, what is the preprocessing in addition to resizing the face image to 224 x 224?

yihuacheng commented 2 years ago
  1. Given an estiamted gaze (x, y, z), you could first normalize the gaze so that the length of gaze vector is consistent. Then, plot a line from origin (center_x, center_y) to target (center_x + x, center_y +y). The pseudo code is:
    
    length = 10 # hyper-parameters.
    origin = (x, y) # e.g. face center.

gaze = gaze/np.linalg.norm(gaze) * length cv2.line(face_img, origin, (x+gaze[0], y+gaze[1])).



How to convert 2D gaze into 3D gaze vector?
- You can check our code "gtools.py".

2. You could follow our data pre-processing  step. You can also directly crop face images and resize them to (224, 224), this is a simple and fast method for test.

Any problem please contact me with email.  I usually do not check the issues.
wyl0228 commented 1 year ago

Hi, I see from your question that you use the code on your own images, but the reader.py file only gives some methods for public data sets. Can you give me some advice on what I should do if I want to use this code on my own data set? Or how do you process the data?