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

运行winpy/main.py遇到的问题 #61

Open
AzureSkyHuHu opened this issue Aug 14, 2020 · 5 comments
Open

运行winpy/main.py遇到的问题 #61

AzureSkyHuHu opened this issue Aug 14, 2020 · 5 comments

Comments

@AzureSkyHuHu
Copy link

我更改了CaptchaDataset 的 getitem
改成读取某个文件夹里的图片
用来测试没问题

但是当用来训练的时候
image
就会报错

因为之前并没接触过这个 所以可能问题描述的不是很清楚
希望有空的时候解答一下

@AzureSkyHuHu
Copy link
Author

RuntimeError: stack expects each tensor to be equal size, but got [4] at entry 0 and [5] at entry 7

@ypwhs
Copy link
Owner

ypwhs commented Aug 16, 2020

你可以检查一下文件夹里的图片,是否都是RGB图片,尺寸是否一致。

如果不一致,你需要手动写一个 collate 函数,对尺寸不一致的图片进行一个补全操作(padding)。
比如先创建一个 (batch_size, height, max_width, 3) 的矩阵,然后将每张图贴进去。

参考链接:

@AzureSkyHuHu
Copy link
Author

已解决 谢谢大佬

@Alexuebo
Copy link

Alexuebo commented May 15, 2021

大佬您好,为什么我检查了我图片尺寸都是一样的(3x70x200),还是出现了这种问题呢?以及collate_fn函数具体要怎么操作啊
image

@jjw12345
Copy link

我是训练效果很差。。。

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