HongwenZhang / PyMAF-X

[TPAMI 2023] PyMAF-X: Towards Well-aligned Full-body Model Regression from Monocular Images
https://www.liuyebin.com/pymaf-x
Other
196 stars 27 forks source link

ValueError: could not broadcast input array #10

Closed Kirstihly closed 1 year ago

Kirstihly commented 1 year ago

Thank you for sharing the code base. However, I have tried folders of images or videos but they all raise weird ValueError: could not broadcast input array from shape (N,M,3) into shape (N,0,3).

According to the error message, I've already checked that new_img[new_y[0]:new_y[1], new_x[0]:new_x[1]] and img[old_y[0]:old_y[1], old_x[0]:old_x[1]] are of the same shape. It would be very much appreciated if anyone can provide me with any idea why this error is happening. Thank you!

Running reconstruction on each tracklet...                                                                                                 
  0%|                                                                                                               | 0/42 [00:00<?, ?it/s]
[W pthreadpool-cpp.cc:90] Warning: Leaking Caffe2 thread-pool after fork. (function pthreadpool)                                           
[W pthreadpool-cpp.cc:90] Warning: Leaking Caffe2 thread-pool after fork. (function pthreadpool)                                           
[W pthreadpool-cpp.cc:90] Warning: Leaking Caffe2 thread-pool after fork. (function pthreadpool)                                           
[W pthreadpool-cpp.cc:90] Warning: Leaking Caffe2 thread-pool after fork. (function pthreadpool)                                           
[W pthreadpool-cpp.cc:90] Warning: Leaking Caffe2 thread-pool after fork. (function pthreadpool)                                           
[W pthreadpool-cpp.cc:90] Warning: Leaking Caffe2 thread-pool after fork. (function pthreadpool)                                           
[W pthreadpool-cpp.cc:90] Warning: Leaking Caffe2 thread-pool after fork. (function pthreadpool)
[W pthreadpool-cpp.cc:90] Warning: Leaking Caffe2 thread-pool after fork. (function pthreadpool)
[W pthreadpool-cpp.cc:90] Warning: Leaking Caffe2 thread-pool after fork. (function pthreadpool)
[W pthreadpool-cpp.cc:90] Warning: Leaking Caffe2 thread-pool after fork. (function pthreadpool)
[W pthreadpool-cpp.cc:90] Warning: Leaking Caffe2 thread-pool after fork. (function pthreadpool)
[W pthreadpool-cpp.cc:90] Warning: Leaking Caffe2 thread-pool after fork. (function pthreadpool)
[W pthreadpool-cpp.cc:90] Warning: Leaking Caffe2 thread-pool after fork. (function pthreadpool)
[W pthreadpool-cpp.cc:90] Warning: Leaking Caffe2 thread-pool after fork. (function pthreadpool)
[W pthreadpool-cpp.cc:90] Warning: Leaking Caffe2 thread-pool after fork. (function pthreadpool)
[W pthreadpool-cpp.cc:90] Warning: Leaking Caffe2 thread-pool after fork. (function pthreadpool)
/root/anaconda3/envs/pymafx/lib/python3.8/site-packages/torch/nn/functional.py:718: UserWarning: Named tensors and all their associated APIs are an experimental feature and subject to change. Please do not use them for anything important until they are released as stable. (Triggered internally at  /opt/conda/conda-bld/pytorch_1623448278899/work/c10/core/TensorImpl.h:1156.)
  return torch.max_pool2d(input, kernel_size, stride, padding, dilation, ceil_mode)
 29%|█████████████████████████████▏                                                                        | 12/42 [00:15<00:38,  1.29s/it]
Traceback (most recent call last): 
  File "/root/anaconda3/envs/pymafx/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/root/anaconda3/envs/pymafx/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/Documents/PyMAF-X/apps/demo_smplx.py", line 604, in <module> 
    run_demo(args)
  File "/Documents/PyMAF-X/apps/demo_smplx.py", line 308, in run_demo 
    for batch in tqdm(dataloader): 
  File "/root/anaconda3/envs/pymafx/lib/python3.8/site-packages/tqdm/std.py", line 1178, in __iter__
    for obj in iterable:
  File "/root/anaconda3/envs/pymafx/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 521, in __next__
    data = self._next_data()
  File "/root/anaconda3/envs/pymafx/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 1183, in _next_data
    return self._process_data(data)
  File "/root/anaconda3/envs/pymafx/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 1229, in _process_data
    data.reraise()
  File "/root/anaconda3/envs/pymafx/lib/python3.8/site-packages/torch/_utils.py", line 425, in reraise
    raise self.exc_type(msg)
ValueError: Caught ValueError in DataLoader worker process 12.
Original Traceback (most recent call last):
  File "/root/anaconda3/envs/pymafx/lib/python3.8/site-packages/torch/utils/data/_utils/worker.py", line 287, in _worker_loop
    data = fetcher.fetch(index)
  File "/root/anaconda3/envs/pymafx/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/root/anaconda3/envs/pymafx/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 44, in <listcomp>
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/Documents/PyMAF-X/datasets/inference.py", line 291, in __getitem__
    img_part, _, crop_shape = self.rgb_processing(img_orig, center_part, scale_part, [constants.IMG_RES, constants.IMG_RES])
  File "/Documents/PyMAF-X/datasets/inference.py", line 124, in rgb_processing
    crop_img_resized, crop_img, crop_shape = crop(rgb_img, center, scale, res, rot=rot)
  File "/Documents/PyMAF-X/utils/imutils.py", line 89, in crop
    new_img[new_y[0]:new_y[1], new_x[0]:new_x[1]] = img[old_y[0]:old_y[1],
ValueError: could not broadcast input array from shape (24,1917,3) into shape (24,0,3)
HongwenZhang commented 1 year ago

Hi, it seems that the image can not be cropped correctly. Which sample are you using in the demo? You may need to print the values of rgb_img.shape, and center, scale for debugging. crop_img_resized, crop_img, crop_shape = crop(rgb_img, center, scale, res, rot=rot)

Kirstihly commented 1 year ago

Hi, it seems that the image can not be cropped correctly. Which sample are you using in the demo? You may need to print the values of rgb_img.shape, and center, scale for debugging. crop_img_resized, crop_img, crop_shape = crop(rgb_img, center, scale, res, rot=rot)

I see. Thank you! I'm using my own dataset and removing some of the noisy frames fixed it.

hrx20000209 commented 6 months ago

Hi! Have you fixed it? I meet the same error.