virtual_try_on_use_deep_learning
virtual_try_on_use_deep_learning copied to clipboard
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (12,) + inhomogeneous part.
File "C:/Project/PycharmProject/virtual_try_on_use_deep_learning/main.py", line 79, in _precompute_coeffs points = np.array([np.arange(row) + xmins[i] for i, row in enumerate(bounds[1::2])]) / filterscale ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (12,) + inhomogeneous part.
问题原因:np.array转换时,成员长度不一致导致转换失败,参考
points = np.array([np.arange(row) + xmins[i] for i, row in enumerate(bounds[1::2])]) / filterscale
以上通过下面替代
temp_list = [np.arange(row) + xmins[i] for i, row in enumerate(bounds[1::2])]
narry = np.zeros([len(temp_list),len(max(temp_list,key = lambda x: len(x)))])
for i,j in enumerate(temp_list):
narry[i][0:len(j)] = j
points = narry/filterscale @gtgor