C-3-Framework icon indicating copy to clipboard operation
C-3-Framework copied to clipboard

Dimension Error! SHHA!

Open haoranD opened this issue 5 years ago • 17 comments

Hi, thanks for your excellent works and discussion.

When I run the train.py for SHHA datasets, I got a dimension error(VGG net). But only happened when I run for SHHA datasets.

RuntimeError: The size of tensor a (376) must match the size of tensor b (377) at non-singleton dimension 1

Can you please give me a suggestion?

haoranD avatar Nov 30 '19 08:11 haoranD

I think the preprocessing has some problems. Because some images still have the odd length or width. I find there are some images's original shape like [1024, 713]. These images may not be resize.

GChen-ai avatar Dec 08 '19 15:12 GChen-ai

Use https://github.com/gjy3035/C-3-Framework/blob/python3.x/datasets/QNRF/preapre_QNRF.m 投process SHHA.

gjy3035 avatar Dec 09 '19 00:12 gjy3035

Cheers!

haoranD avatar Dec 12 '19 09:12 haoranD

I have this same problem and I have been tried to run prepare_QNRF, but get an error which don't have annpoints function . Can u help me or provide prepared datasets

muzishen avatar Dec 26 '19 06:12 muzishen

@muzishen https://mailnwpueducn-my.sharepoint.com/:f:/g/personal/gjy3035_mail_nwpu_edu_cn/EkxvOVJBVuxPsu75YfYhv9UBKRFNP7WgLdxXFMSeHGhXjQ?e=IdyAzA

gjy3035 avatar Dec 26 '19 08:12 gjy3035

@gjy3035 Hi ! Thanks for your timely reply. I tried the data set you provided and ran your project, but the same problem occurred. Has the SHHA been updated? I wonder if the SHHA you provided still has an odd scale

muzishen avatar Dec 26 '19 08:12 muzishen

You can find the annpoints in preapre_SHHB.m. annPoints = image_info{1}.location; You can try to modify it.

GChen-ai avatar Dec 26 '19 15:12 GChen-ai

你好,我使用prepare_SHHB.m文件对SHHA中的图像进行resize,发现并没有任何改变,仔细看应该的.m中的程序有问题。所以我直接把每个图像的size变成standard_size = [768,1024] ,然后density对应相乘长、宽前后的比值,请问这种做法会影响groundtruth准确性吗?

ydlu avatar Dec 29 '19 13:12 ydlu

@ydlu 上海B自身尺寸就是768x1024,因此不会有任何变化. 量化后准确性基本不会变化。 @muzishen We will reproduce the generation of the density map from the dot map or points using conv layer. So we have no plan to provide the processed density data.

gjy3035 avatar Dec 29 '19 14:12 gjy3035

我是说SHHA中的图像尺寸有问题,我用prepare.m文件把SHHA中的图像做了处理,resize成[768,1024] 。

ydlu avatar Dec 30 '19 01:12 ydlu

@ydlu 抱歉,看错了你的评论。使用prepare_QNRF.py去resize即可。参见:https://github.com/gjy3035/C-3-Framework/issues/54#issuecomment-563015061

gjy3035 avatar Dec 30 '19 01:12 gjy3035

which net do you use? find the net.py you use in ./models,:add shape = x.shape at the beginning of forward func and use: x = F.interpolate(x, size=[shape[2], shape[3]]) instead of : x = F.upsample(x,scale_factor=8)

I fixed this error with this solution.hope it will be useful for you.

NygmaLin avatar May 19 '20 12:05 NygmaLin

Cheers!

Hello.Have you obtained the correct data set? Can you send me a copy? I have never used Matlab.. Thank you.

Flyooofly avatar Aug 11 '21 04:08 Flyooofly

You can find the annpoints in preapre_SHHB.m. annPoints = image_info{1}.location; You can try to modify it.

Have you obtained the correct data set? Can you send me a copy? I have never used Matlab.. Thank you

Flyooofly avatar Aug 11 '21 04:08 Flyooofly

@gjy3035 Hi ! Thanks for your timely reply. I tried the data set you provided and ran your project, but the same problem occurred. Has the SHHA been updated? I wonder if the SHHA you provided still has an odd scale

Have you obtained the correct data set? Can you send me a copy? I have never used Matlab.. Thank you

Flyooofly avatar Aug 11 '21 04:08 Flyooofly

Hi, thanks for your excellent works and discussion.

When I run the train.py for SHHA datasets, I got a dimension error(VGG net). But only happened when I run for SHHA datasets.

RuntimeError: The size of tensor a (376) must match the size of tensor b (377) at non-singleton dimension 1

Can you please give me a suggestion?

Have you obtained the correct data set? Can you send me a copy? I have never used Matlab.. Thank you

Flyooofly avatar Aug 11 '21 04:08 Flyooofly

Why do I still get an error when I directly use the SHHA dataset file in csv format provided by the author? RuntimeError: The size of tensor a (672) must match the size of tensor b (683) at non-singleton dimension 0

13970716471 avatar Jun 04 '23 10:06 13970716471