alexandrosstergiou / SoftPool

[ICCV 2021] Code for approximated exponential maximum pooling

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

about result picture

zhangxue2115 opened this issue · comments

I want to get a result picture after softpooling to compare with other method,how can I do ?

Hi @zhangxue2115 ,

You can convert your images to a pytorch tensor and then use the corresponding soft_pool2d() function

I am very happy to receive your reply, but I still have some questions. After my picture is converted into a pytorch tensor, torch Size =([3, 1080, 1920]), when I use soft_ Pool2d, it will report a mistake atx = F.avg_pool2d(x.mul(e_x), kernel_size, stride=stride).mul_(sum(kernel_size)).div_(F.avg_pool2d(e_x, kernel_size, stride=stride).mul_(sum(kernel_size))),showing"Given` input size: (3x1x1920). Calculated output size: (3x-4x956). Output size is too small" where is my error? I cant find it...

As the error states, your tensor is of size 3x1x1920, so you should check the size of the tensor that you are using as an argument. Also, you should include a batch dimension.
This works fine for example:

import torch
import softpool_cuda
from SoftPool import soft_pool2d

tmp = torch.rand(1,3,1080,1920)
s1 = soft_pool2d(tmp)
# s1.shape is [1, 3, 540, 960]

Your reply is very helpful to me.Thank you for your patience.