mmpose icon indicating copy to clipboard operation
mmpose copied to clipboard

A little error report about BaseHead and HeatmapHead class in mmpose 1.0.0 rc

Open xinxinxinxu opened this issue 2 years ago • 2 comments

I wonder if anyone has encountered a similar problem when using a single-resolution pred map to consulate mseloss , there will report that tensors size mismatch between preds and gt. For instance, the output of the backbone is not a list but a tensor, like (64, 32, 64, 64). When it is processed by the __transform_inputs function(a private function of BaseHead class), it will lose a dimension, like turning to (16, 64, 64).

However, this error does not exist in the previous version. I found this is because there is a conditional statement that was missing in the new version, after adding it, the error will no longer be reported.

Original: image

Modified: image

Thanks to the developers for their contributions! Hope this report is helpful for everyone!

xinxinxinxu avatar Nov 24 '22 15:11 xinxinxinxu

Hi, thanks for using MMPose. In MMPose 1.x, the default output of the backbone is a tuple, with which heads are designed to deal. For example, the raw output of Resnet50 (a tensor) will be packed into a tuple with length 1, and will be unpacked in xxhead._transform_inputs with parameters input_transform='select' and input_index=-1.

But I think your modification makes sense. Because the output of most backbones that are not implemented in MMPose is a tensor. If users want to try some advanced networks in pose estimation with MMPose, they should not be bothered by this adaptation problem. What do you think? @ly015

Ben-Louis avatar Nov 25 '22 02:11 Ben-Louis

@xinxinxinxu Thanks for reporting this issue. The modification is indeed necessary for users who would like to implement their own backbone.

Would you be willing to submit a pull request to MMPose dev-1.x branch to fix this issue? A brief guide to contributing codes to MMPose can be found at: https://mmpose.readthedocs.io/en/dev-1.x/notes/contribution_guide.html. Your contribution would be much appreciated.

ly015 avatar Nov 25 '22 03:11 ly015