GithubHelp home page GithubHelp logo

ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (2,) + inhomogeneous part. about eat_code HOT 2 CLOSED

lililuya avatar lililuya commented on July 28, 2024
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (2,) + inhomogeneous part.

from eat_code.

Comments (2)

lililuya avatar lililuya commented on July 28, 2024

Hi,thanks for your great work , I‘ve encountered a problem when I use my own image for testing in the proceeding of extract_keypoints. The error sources from the function extract_keypoints in part of "np.save(file_path, [kc, he])", it reminds that "NumPy requires that all elements of a multi-dimensional array have the same shape." To find out the dim problem, I use the provided image latent npy file, the dim for the he are "yaw(1, 66)、pitch(1, 66)、roll(1, 66)、t(1, 3)、exp(1, 45)" When in testing , I also print the dim, It's exactly the same dim, but can't save the npy file, it seems only can use pkl for saving.

Python version 3.9.19 Numpy version 1.23.5 in /home/miniconda3/envs/EAT/lib/python3.9/site-packages/numpy/lib/npyio.py

def save(file, arr, allow_pickle=True, fix_imports=True):
    if hasattr(file, 'write'):
        file_ctx = contextlib.nullcontext(file)
    else:
        file = os_fspath(file)
        if not file.endswith('.npy'):
            file = file + '.npy'
        file_ctx = open(file, "wb")

    with file_ctx as fid:
        arr = np.asanyarray(arr)  # call error
        format.write_array(fid, arr, allow_pickle=allow_pickle,
                           pickle_kwargs=dict(fix_imports=fix_imports))

in /home/miniconda3/envs/EAT/lib/python3.9/site-packages/numpy/lib/npyio.py
add dtype="object" in
image

from eat_code.

lililuya avatar lililuya commented on July 28, 2024

Another problem encountered in modules/transformer "RuntimeError: view size is not compatible with input tensor's size and stride (at least one dimension spans across two contiguous subspaces). Use ".reshape(...) instead."

Fixed by change the .view(...) to .contiguous().view(...)" from https://stackoverflow.com/questions/66750391/runtimeerror-view-size-is-not-compatible-with-input-tensors-size-and-stride-a . Modify as

return yaw, pitch, roll, yaw_mat.contiguous().view(yaw_mat.shape[0], 9), pitch_mat.contiguous().view(pitch_mat.shape[0], 9), roll_mat.contiguous().view(roll_mat.shape[0], 9), rot_mat.contiguous().view(rot_mat.shape[0], 9)

from eat_code.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.