GeneFace icon indicating copy to clipboard operation
GeneFace copied to clipboard

執行CUDA_VISIBLE_DEVICES=0 python deep_3drecon/test.py 出現error

Open jerry4308 opened this issue 1 year ago • 10 comments

error 訊息: Traceback (most recent call last): File "/home/GeneFace/deep_3drecon/test.py", line 68, in main(0, opt, 'deep_3drecon/datasets/examples') File "/home/GeneFace/deep_3drecon/test.py", line 52, in main im_tensor, lm_tensor = read_data(im_path[i], lm_path[i], lm3d_std) File "/home/GeneFace/deep_3drecon/test.py", line 27, in read_data _, im, lm, _ = align_img(im, lm, lm3d_std) File "/home/GeneFace/deep_3drecon/util/preprocess.py", line 204, in align_img trans_params = np.array([w0, h0, s, t[0], t[1]]) ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (5,) + inhomogeneous part.

請問一下,這個問題該如何處理呢? 是我那個步驟有出錯嗎? 謝謝~

jerry4308 avatar May 17 '23 00:05 jerry4308

後來我發現把出錯那行裡面所提的那5個變數,全部轉型成為int資料型態就可以了,已解決!

jerry4308 avatar May 31 '23 08:05 jerry4308

@jerry4308 How did you resolve it, can you please explain

Parikshat1998 avatar Jun 18 '23 12:06 Parikshat1998

w0, h0, s, t[0], t[1]

I remember I just changed the type of the above variables as the same type.

^^

jerry4308 avatar Jun 19 '23 03:06 jerry4308

@jerry4308 can you be more precise

premgadwal avatar Jun 21 '23 13:06 premgadwal

请问是在哪一步转换的呢,为什么我直接转换了还是报这个错?

feifeitu1 avatar Jun 22 '23 13:06 feifeitu1

try this code

trans_params = np.array([w0, h0, s, t[0][0], t[1][0]])

skrudrjs avatar Jun 23 '23 09:06 skrudrjs

好的,谢谢~

feifeitu1 avatar Jun 23 '23 15:06 feifeitu1

Why this bug author has not fixed so far

xiao-keeplearning avatar Jun 26 '23 02:06 xiao-keeplearning

You can do this to fix the problem.

output1 = s.item()
output2 = t.item(0)
output3 = t.item(1)

trans_params = np.array([w0, h0, output1, output2, output3])

jerry4308 avatar Jul 10 '23 08:07 jerry4308

try this code

trans_params = np.array([w0, h0, s, t[0][0], t[1][0]])

YES,this method works very well.

Pythonpa avatar Aug 15 '23 09:08 Pythonpa