TadasBaltrusaitis / OpenFace

OpenFace – a state-of-the art tool intended for facial landmark detection, head pose estimation, facial action unit recognition, and eye-gaze estimation.
Other
6.91k stars 1.84k forks source link

Odd revers of gaze vectors #266

Open palich12 opened 7 years ago

palich12 commented 7 years ago

Hi, Tadas! I try draw data form output and see odd revers of gaze vectors, like in image image I see that face shape rotate correctly, but gaze vectors viewed like in mirror image

palich12 commented 7 years ago

Left side of face have more size that right side. So I think that face drow correctly, but vectors is mirrored

palich12 commented 7 years ago

Its code for calc vectors coordinates

series = [
    go.Scatter3d(
        x=face.x,
        y=face.y,
        z=face.z,
        mode='markers',
        marker=dict(
            color='rgb(64, 64, 255)',
            size=4,
            symbol='circle',
            opacity=0.9
        )
    ),
    go.Scatter3d(
        x=[photo_data['Eye_x_1'].values[0], photo_data['Eye_x_1'].values[0] + (photo_data['dir_x_1'].values[0] + photo_data['eul_x'].values[0]) * vector_len/2.0],
        y=[photo_data['Eye_y_1'].values[0], photo_data['Eye_y_1'].values[0] + (photo_data['dir_y_1'].values[0] + photo_data['eul_y'].values[0]) * vector_len/2.0],
        z=[photo_data['Eye_z_1'].values[0], photo_data['Eye_z_1'].values[0] + (photo_data['dir_z_1'].values[0] + photo_data['eul_z'].values[0]) * vector_len/2.0],
        mode='lines',
        line=dict(
            width=5
        )
    ), 
    go.Scatter3d(
        x=[photo_data['Eye_x_2'].values[0], photo_data['Eye_x_2'].values[0] + (photo_data['dir_x_2'].values[0] + photo_data['eul_x'].values[0]) * vector_len/2.0],
        y=[photo_data['Eye_y_2'].values[0], photo_data['Eye_y_2'].values[0] + (photo_data['dir_y_2'].values[0] + photo_data['eul_y'].values[0]) * vector_len/2.0],
        z=[photo_data['Eye_z_2'].values[0], photo_data['Eye_z_2'].values[0] + (photo_data['dir_z_2'].values[0] + photo_data['eul_z'].values[0]) * vector_len/2.0],
        mode='lines',
        line=dict(
            width=5
        )
    )
    ]
palich12 commented 7 years ago
print(photo_data['dir_x_1'].values[0])
print(photo_data['dir_y_1'].values[0])
print(photo_data['dir_z_1'].values[0])
print("------------------------------")
print(photo_data['dir_x_2'].values[0])
print(photo_data['dir_y_2'].values[0])
print(photo_data['dir_z_2'].values[0])
print("------------------------------")
print(photo_data['eul_x'].values[0])
print(photo_data['eul_y'].values[0])
print(photo_data['eul_z'].values[0])

0.0661739 0.0588263 -0.996073

-0.178829 0.0491437 -0.982652

-0.0816857 -0.0499304 -0.0113478

TadasBaltrusaitis commented 7 years ago

Hi,

The code for drawing the gaze vectors can be found in C++ code, specifically the: GazeAnalysis::DrawGaze function

It basically takes the 3D pupil location and the 3D location of the gaze vector + pupil location and draws a 2D projected line connecting them. It seems like you are flipping the eyes and the x values somewhere.

Thanks, Tadas

palich12 commented 7 years ago

Yes, i think that i do mistake and flipping something at start. But i check all my code and anilyze output data from OpenFace, so you can check it by youself. It's input image image It's output Image image It's otput data: version: 1 npoints: 68 { 289.74 284.776 291.833 306.29 295.71 327.266 301.431 347.269 311.479 365.321 326.46 380.092 342.941 391.384 361.027 399.912 379.808 401.75 396.268 398.235 409.279 387.521 420.769 374.51 430.025 358.86 435.796 341.018 438.909 322.514 441.156 303.777 441.829 285.271 306.129 262.986 317.702 253.347 333.507 250.167 349.57 252.251 364.434 257.871 394.84 257.38 406.963 251.793 419.098 249.829 430.676 251.373 438.393 259.223 380.465 277.052 381.989 289.782 383.705 302.319 385.457 315.378 366.376 327.795 374.509 329.978 382.469 331.846 389.916 329.792 396.394 327.07 323.842 282.202 333.353 277.185 344.595 276.933 353.937 282.455 344.299 285.78 333.215 286.093 398.153 281.815 407.1 276.032 417.56 276.171 425.053 280.744 418.207 284.7 408.004 284.778 350.223 357.558 363.725 351.591 375.114 348.174 381.978 349.986 388.725 347.877 398.024 351.208 405.988 356.058 398.236 364.206 389.313 367.67 382.016 368.603 374.549 368.299 363.215 365.305 355.577 357.649 374.817 356.103 381.818 356.44 388.7 355.53 401.537 356.591 388.723 356.615 381.882 357.615 374.796 357.351 } pose: eul_x, eul_y, eul_z: { -0.0816857 -0.0499304 -0.0113478 } gaze: dir_x_1, dir_y_1, dir_z_1, dir_x_2, dir_y_2, dir_z_2: { 0.0661739 0.0588263 -0.996073 -0.178829 0.0491437 -0.982652 } au intensities: 17 { AU01 2.74918 AU02 2.48718 AU04 0 AU05 0 AU06 0 AU07 0 AU09 0.254734 AU10 0 AU12 0 AU14 0 AU15 0.699943 AU17 0 AU20 0 AU23 0.407069 AU25 0 AU26 0 AU45 0 } au occurences: 18 { AU01 0 AU02 1 AU04 0 AU05 1 AU06 0 AU07 0 AU09 0 AU10 0 AU12 0 AU14 0 AU15 1 AU17 0 AU20 0 AU23 1 AU25 0 AU26 1 AU28 0 AU45 0 } You can see that dir_x_2 < 0 but in image it sign to right. It's realy that girl watch to right and output imge is correct but in output data file may by have some vistake. Can you check it, please?