Pongpisit-Thanasutives / Variations-of-SFANet-for-Crowd-Counting

The official implementation of "Encoder-Decoder Based Convolutional Neural Networks with Multi-Scale-Aware Modules for Crowd Counting"
https://ieeexplore.ieee.org/document/9413286
GNU General Public License v3.0
110 stars 32 forks source link

About "max_unpool2d" function #29

Open ChenFan666 opened 2 years ago

ChenFan666 commented 2 years ago

When i use another backbone , i meet this problem: image I cheak the conv5_3.shape and id4.shape , they meet the requirements of the "max_unpool2d" function image Could you help me?please!

Pongpisit-Thanasutives commented 2 years ago

Based on the error message, casting the type of elements in id4 to be torch.int64 may solve the problem.

Like this ... id4 = id4.type(torch.int64)

ChenFan666 commented 2 years ago

Thank you for your explanation, but after I made the modification, the following problems occurred image This is their shape: image I see this tensor have the same channel in your code, and i make my tensor's channel to same, but still report error

ChenFan666 commented 2 years ago

This my fault, i not use the maxpool,just want use the unmaxpool,thank you very much!

Pongpisit-Thanasutives commented 2 years ago

That's fine. The max_unpool is used together with the max_pooling operation. You may see https://pytorch.org/docs/stable/generated/torch.nn.MaxUnpool2d.html. And, the indices should be positive integers.