Model predictions different in Nvidia Xavier NX and in x86

Hi,

I ran head pose estimation model from GitHub - yinguobing/head-pose-estimation: Head pose estimation by TensorFlow and OpenCV and the values I get from the facial landmark model predictions are different in x86 and Xavier.In x86,the model works fine.

But when I run the model from the repo given above in the board,

I get this particular error :

mark_detector.py", line 208, in draw_marks
cv2.circle(image, (int(mark[0]), int(mark[1])), 1, color, -1, cv2.LINE_AA)
OverflowError: Python int too large to convert to C long

There was no such error in x86.
I want to print the points in the image.I managed to bypass this error by typecasting.

Anyhow,the value returned by the model and x86 is different.

For x86, the values returned by the model are :
MARKS of 2020-10-14-110201_20.jpg
[[0.1016712 0.17136078]
[0.09862911 0.2954145 ]
[0.09967319 0.41962394] … and so on

Where as in Xavier Nx it is,

MARKS of 2020-10-14-110201_14.jpg
[[-3.67846022e+33 -1.48429234e+34]
[-5.81375080e+33 -1.23074810e+34]
[-7.28711919e+33 -9.70447565e+33] … and so on

Please provide suggestions on how to resolve this issue.

Environment

TensorRT Version : 7.1.3.0
Nvidia Driver Version : 32.4.3
CUDA Version : 10.2.89
CUDNN Version : 8.0.0
Operating System + Version : Ubuntu 18.04.5 LTS
Python Version : python3.6
TensorFlow Version : 1.15.2
Jetpack version - 4.4
keras version - 2.1.5

Hi,

Thanks for reporting this.

We are going to reproduce this issue.
Will share more information with you later.

Thanks.

Hi,

Would you mind to share the testing video with us also?
Thanks.

Hi ,

I have attached one image and one video here.

Model predictions in x86 :
predictions [[0.10143851 0.23334025 0.12099908 0.35100228 0.15045662 0.4629949
0.18998767 0.57363796 0.2423134 0.6739491 0.30779037 0.7637135
0.3802693 0.8430855 0.46049815 0.9061937 0.5530348 0.9190479
0.6486103 0.88995963 0.7318635 0.8136509 0.8097497 0.7179861
0.8719826 0.6126404 0.9109161 0.49669793 0.92768085 0.36938632
0.9305428 0.23964539 0.92740333 0.10668427 0.14814128 0.27608645
0.19960336 0.2577204 0.26359072 0.2658475 0.3309059 0.2829528
0.39570522 0.30547324 0.50060713 0.2927096 0.5679641 0.2537086
0.64208364 0.22171092 0.7207813 0.20865285 0.7940953 0.22040732
0.45555738 0.35679302 0.45998943 0.44076198 0.46293566 0.5254735
0.4672627 0.61168927 0.39587826 0.613803 0.43508667 0.6396817
0.48650727 0.6515585 0.5366907 0.6331036 0.5778056 0.60510993
0.22861116 0.34529847 0.27293262 0.34442127 0.32128653 0.34538984
0.36435273 0.3496527 0.32151747 0.36767262 0.27228755 0.36899614
0.57024485 0.33158 0.6143886 0.31834936 0.6642885 0.3126764
0.7139132 0.30535096 0.6706125 0.33445382 0.6203492 0.34186727
0.38182223 0.70578843 0.42533928 0.70278186 0.46527922 0.7023023
0.50024134 0.7093016 0.53742063 0.6977351 0.5928132 0.6897826
0.6575615 0.68162763 0.60740435 0.7492517 0.55501574 0.78446263
0.5132025 0.79189706 0.47465968 0.7880919 0.4282409 0.7610109
0.40441108 0.71344006 0.4680105 0.72436464 0.503827 0.7285689
0.5418092 0.72056144 0.6327909 0.6916072 0.5467728 0.72911227
0.50716066 0.737792 0.47016442 0.7331978 ]]

Model predictions in Xavier :
predictions [[-2.29144558e+32 3.74463214e+33 3.62731008e+33 4.68410297e+33
1.68106950e+33 3.52233865e+33 6.14296858e+33 4.28108664e+33
4.44735035e+33 3.10410494e+33 6.14083994e+33 1.26698846e+33
5.71081052e+33 6.67631702e+31 9.63340242e+33 -5.81116521e+32
7.97679725e+33 -7.82134231e+32 9.97759865e+33 -1.68648456e+33
9.59064087e+33 8.37590772e+32 1.00689524e+34 2.84254925e+33
1.07849559e+34 3.65730258e+33 8.34511102e+33 2.43375731e+33
6.67693173e+33 3.49874072e+33 7.21073210e+33 3.02189241e+33
8.51434485e+33 7.74023750e+31 4.37760047e+32 -5.48286367e+33
-7.56841027e+32 5.16809575e+33 -1.60015603e+33 8.42126167e+33
-3.28734358e+33 9.53251278e+33 -7.53120630e+33 6.43655101e+33
6.19146736e+33 3.88303445e+33 4.83316303e+33 4.65674729e+33
5.41798447e+33 7.54431732e+33 5.12512809e+33 8.19550117e+32
1.01388410e+34 -1.05103461e+34 -6.77270930e+33 -6.60861524e+31
-6.63184967e+33 -2.40279287e+32 -9.53017555e+33 2.70836212e+33
-9.31973626e+33 1.78405636e+33 -6.63577146e+33 2.79576286e+33
-8.07350636e+33 1.10814914e+33 -6.62884333e+33 -1.60387163e+32
-6.20174350e+33 -2.89988711e+32 -6.43387149e+33 1.55434188e+33
-9.64724661e+32 6.02767706e+32 -2.09686168e+33 3.14668141e+33
-3.13841073e+33 3.72009833e+33 -1.69854225e+33 2.06090927e+33
-3.50907938e+33 3.05885699e+33 -3.45270019e+33 4.21487325e+33
5.87523805e+33 1.75124723e+33 3.55909959e+33 7.68557742e+32
5.45595147e+33 2.19957310e+33 6.42439444e+33 9.58939535e+32
4.20461444e+33 2.26849371e+33 5.57013597e+33 2.56862159e+33
1.55008476e+33 8.08973390e+32 -3.22957821e+33 -2.11478442e+33
-2.87707385e+33 -2.32825186e+33 -3.95678999e+33 -4.81065635e+33
-2.75249995e+33 -2.83116082e+33 5.30704895e+30 -1.94815661e+33
2.29111505e+33 1.62303572e+32 4.32166848e+33 -8.45711272e+32
2.00387304e+33 2.59554246e+31 1.41189228e+33 -1.97744673e+31
-1.99012076e+33 -1.76796097e+33 -2.32579130e+33 -5.01036965e+32
-3.44576958e+33 2.38754424e+33 -3.96265814e+33 -2.38948827e+33
-1.82238376e+33 -2.94946054e+33 -1.77716320e+33 -9.31745474e+32
5.34728881e+33 1.00199640e+33 1.06200864e+32 -8.92268495e+31
-3.03893544e+32 3.42930591e+32 -6.97210848e+32 9.51666715e+32]]


Hi,

We confirm that we cannot reproduce this issue in our environment.
(JetPack4.5.1 + TensorFlow 2.4.0)

We slightly modify the estimate_head_pose.py to take image as input.
The output prediction and image works good in our environment.

Could you also give it a check?
estimate_head_pose_img.py (5.1 KB)

$ python3 estimate_head_pose_img.py --video [path/to/jpeg]
[[0.12360457 0.22807516]
 [0.14403018 0.323653  ]
 [0.17033896 0.44066334]
 [0.20388402 0.5160697 ]
 [0.22986525 0.6224368 ]
 [0.30965257 0.70098525]
 [0.36193824 0.7674389 ]
 [0.42780793 0.8384437 ]
 [0.51072794 0.8415206 ]
 [0.6007482  0.81200707]
 [0.68114567 0.7730703 ]
 [0.73378444 0.69239444]
 [0.82166225 0.60204387]
 [0.84435654 0.4871047 ]
 [0.8693066  0.38369188]
 [0.8762258  0.2676376 ]
 [0.8898219  0.13848956]
 [0.1363228  0.26963434]
 [0.18767814 0.2659303 ]
 [0.24881603 0.27316362]
 [0.30783752 0.2917469 ]
 [0.36852068 0.29682887]
 [0.50038475 0.28196448]
 [0.56662774 0.24707153]
 [0.6229945  0.21255398]
 [0.69755465 0.19255024]
 [0.7857508  0.21982808]
 [0.44632187 0.35062167]
 [0.4510728  0.42912608]
 [0.45066795 0.49064976]
 [0.43564323 0.5641664 ]
 [0.36422908 0.5656126 ]
 [0.401911   0.60866094]
 [0.4433755  0.61390054]
 [0.5161683  0.589177  ]
 [0.5445334  0.5702061 ]
 [0.22246477 0.34450066]
 [0.2830962  0.35626742]
 [0.29248026 0.33090207]
 [0.35448822 0.3543399 ]
 [0.30950978 0.37233377]
 [0.2731109  0.37748587]
 [0.55888784 0.31611395]
 [0.60410386 0.3090512 ]
 [0.64079154 0.31485263]
 [0.6971308  0.27984875]
 [0.6447598  0.31567046]
 [0.61899173 0.33284947]
 [0.3389669  0.6404039 ]
 [0.38428384 0.65079284]
 [0.43236142 0.6342782 ]
 [0.47295114 0.66068333]
 [0.5174692  0.6455212 ]
 [0.5681305  0.62421894]
 [0.6453988  0.6219028 ]
 [0.5806773  0.68327487]
 [0.53152585 0.74777794]
 [0.47604117 0.75579756]
 [0.44271612 0.7382926 ]
 [0.40712675 0.7121135 ]
 [0.38432008 0.6662947 ]
 [0.43165967 0.6732993 ]
 [0.46390936 0.6808406 ]
 [0.49681142 0.66989636]
 [0.6133517  0.64296514]
 [0.52414924 0.6969435 ]
 [0.49020085 0.712543  ]
 [0.43854195 0.7063036 ]]

Thanks.

Hi,
I got this error once I ran the script.

It seems like its a tensorflow version issue.
Do I need to flash new jetpack version?
The current Jetpack version is 4.4 and tensorflow version is 1.15.2

Hi,

The model shared by the GitHub is in the format of TensorFlow v2.
That’s why we verify it with TensorFlow v2.4 rather v1.15.

Maybe you can give TensorFlow v2 a try before reflashing.
Thanks.