postech-ami / FastMETRO

[ECCV'22] Official PyTorch Implementation of "Cross-Attention of Disentangled Modalities for 3D Human Mesh Recovery with Transformers"

Home Page:https://fastmetro.github.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ValueError: could not broadcast input array from shape (2048,2025,3) into shape (2048,0,3)

zearo-github opened this issue · comments

When I try to change the size of the input image from 224x224 to 256x192, I get an error:
ValueError: could not broadcast input array from shape (2048,2025,3) into shape (2048,0,3)
image

I modified self.img_res = [192,256] in human_mesh_tsv.py, Then load the data in the main program (for _, (img_keys, images, annotations) in enumerate(train_dataloader):) Times is wrong, only some of the images are wrong, The new_x and old_x calculated by the crop function in image_ops.py are both larger than the second value, such as new_x =(1957, 1934) old_x =(0, -23), resulting in the final error. How do I change the code?
I noticed that the x coordinates marked in the center of the wrong picture are all negative values with large absolute values (more than 100). Is it caused by him?

Hello,

After investigating your issue, we found that such negative x-coordinates in bbox center annotations seem to be intended. As shown in the below figure, negative values are used to properly handle exceptional cases where bbox centers are outside images.

081151

We’re willing to provide possible solutions for your issue.

Simple Solution

When we set self.img_res = [256,192] instead of self.img_res = [192,256] and change relevant codes accordingly, everything seems to work without errors. The error you faced seems to be caused by different padding sizes depending on image resolutions (pad = int(np.linalg.norm(br - ul) / 2 - float(br[1] - ul[1]) / 2) in crop() of src/utils/image_ops.py). Such padding sizes should be large enough to include bounding boxes which have negative center coordinates.

Other Solutions

When we investigated negative x-coordinates in bbox center annotations, we noticed those are the annotations (reorganized by METRO) for the MuCo dataset. You could modify annotations for your own purpose. Or, you could simply ignore the MuCo dataset while training your model.

How to Modify Annotations

Based on GraphCMR’s preprocess and Pose2Mesh’s annotations, METRO reorganizes annotations using this code. You might be able to resolve your issue by modifying METRO’s reorganization code with Pose2Mesh’s annotations for the MuCo dataset.

Recommendations

If you want to use different image resolutions having different aspect ratios, then you need to change pre-trained CNN weights accordingly. The CNN weights used in our research might be inappropriate for your research.

Thanks for your interest in our work!!

Please reopen this issue if you need more help regarding this.

Thank you for your help!
I will try your suggestions.