Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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. #7

Open
gtgor opened this issue Apr 13, 2023 · 1 comment

Comments

@gtgor
Copy link

gtgor commented Apr 13, 2023

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.

@guofenggitlearning
Copy link

guofenggitlearning commented Sep 19, 2023

问题原因: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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants