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

I ran into this problem when running a demo with my own video #18

Open
zbc-l opened this issue May 25, 2023 · 3 comments
Open

I ran into this problem when running a demo with my own video #18

zbc-l opened this issue May 25, 2023 · 3 comments

Comments

@zbc-l
Copy link

zbc-l commented May 25, 2023

ValueError: Caught ValueError in DataLoader worker process 2.Original Traceback (most recent call last):
File"/home/tia/anaconda3/envs/pymafx/tib/python3.8/site-packageline 287,in _worker_loopdata = fetcher .fetch(index)_utils/fetch.py", line 44,in fetchFile "/home/tia/anaconda3/envs/pymafx/lib/python3.8/site-packagesdata = [self.datasetlidx] for idx in possibly_batched indexFile "/home/lia/anaconda3/envs/pymafx/lib/python3.8/site-packages/torch/utils/data/utils/fetch.py", line 44, in <listcomp3data = [self.dataset[idx] for idx in possiblybatched index]File "/home/lia/projects/PyMAF-X-smplx/datasets/inference.py", line 291,in --getitem-img_part, -, crop_shape = self.rg-processing(img_orig, center_part, scale_part, [constants.IM6_RES, constants.IM6_RESJ)File "/home/lia/projects/PyMAF-X-smplx/datasets/inference.py", line 124, in rgb_processingcrop_img_resized, crop_img, crop_shape = crop(rgb_img, center, scale, res, rot=rot)File"/home/lia/projects/PyMAF-X-smplx/utils/imutils.py",line 89,in cropnew_img[new_y[o]:new_y[1],new_x[o]:new_x[1]] = img[old_y[o]:old_y[1l,ValueError: could not broadcast input array from shape (12,358,3) into shape (12,0,3)

@lithiumice
Copy link

I had the same problem. I wonder there are some bug in this version of the code

@hrx20000209
Copy link

I meet this problem too.

@hrx20000209
Copy link

I have solved this problem by addint this code to the utils/imutils.py:

def crop(img, center, scale, res, rot=0):
    # ...

    # Range to fill new array
    new_x = max(0, -ul[0]), min(br[0], len(img[0])) - ul[0]
    new_y = max(0, -ul[1]), min(br[1], len(img)) - ul[1]
    # Range to sample from original image
    old_x = max(0, ul[0]), min(len(img[0]), br[0])
    old_y = max(0, ul[1]), min(len(img), br[1])

    a, b = min(new_y[0], new_y[1]), max(new_y[0], new_y[1])
    c, d = min(new_x[0], new_x[1]), max(new_x[0], new_x[1])
    e, f = min(old_y[0], old_y[1]), max(old_y[0], old_y[1])
    g, h = min(old_x[0], old_x[1]), max(old_x[0], old_x[1])

    new_img[a:b, c:d] = img[e:f, g:h]

    # new_img[new_y[0]:new_y[1], new_x[0]:new_x[1]] = img[old_y[0]:old_y[1], old_x[0]:old_x[1]]
    # ...
   
    return new_img_resized, new_img, new_shape

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

3 participants