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

Clues to solve ValueError: res["lidar"]["bev_map"] axes don't match array #3

Closed
MaxChanger opened this issue May 17, 2022 · 3 comments

Comments

@MaxChanger
Copy link

Hi, thanks for the great work. And I meet the same issue with issue#2, as following,

  File "~/Repo/FutureDet/det3d/datasets/pipelines/preprocess.py", line 221, in __call__
    res["lidar"]["bev_map"] = bev.transpose(2, 0, 1)
ValueError: axes don't match array

Although I use the v1.0-mini nuscenes data, I don't think it matters.
After my debugging, I found that the problem lies in the bev process of generating info_xxx.pkl, as follows

ego_map = nusc.get_ego_centric_map(sweeps[0]["sample_data_token"])
bev = cv2.resize(ego_map, dsize=(180, 180), interpolation=cv2.INTER_CUBIC)

The BEV image is loaded from the sdk in your another repo python-sdk/nuscenes/nuscenes.py#L837-L842

But their dimensions are (h,w), such as ego_map.shape: (900, 900), bev.shape: (180, 180), so bev.transpose(2, 0, 1) is wrong operations for this.

Hope that can provide clues to solve the problem.

@YiiiMeng
Copy link

I also encounter this problem, and I try to uncomment the line 211 and 214 (just above the bug line) in the preprocess.py, and it works.

@MaxChanger
Copy link
Author

Thanks @YiMengNB, in issue#2, the author said''res["lidar"]["bev_map"] should be an empty numpy array of size (1, 180, 180)'' .
So, I simply added a dimension to bev before this line, such as bev = bev[None, :, :], it also work. The predicted output can be obtained normally.

But I'm not sure if this is completely correct and consistent with the original intent.

@chenkangyang
Copy link

This is reasonable to get 6 channel bevmap
Cuz

if self.bev_map:
    self.bev_conv = nn.Sequential(
        nn.Conv2d(6, 16, kernel_size=3, padding=1, bias=True), nn.BatchNorm2d(16), nn.ReLU(inplace=True),
        nn.Conv2d(16, 32, kernel_size=3, padding=1, bias=True), nn.BatchNorm2d(32), nn.ReLU(inplace=True),
        nn.Conv2d(32, share_conv_channel, kernel_size=3, padding=1, bias=True), nn.BatchNorm2d(share_conv_channel), nn.ReLU(inplace=True),
    )

in center_head.py

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

4 participants