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

How to let custom datasets support the fast path for computing the aspect ratio? #70

Closed
uniyushu opened this issue Oct 23, 2020 · 3 comments

Comments

@uniyushu
Copy link

Describe the current behavior
My custom dataset doesn't support the fast path, iterating the full dataset is too slow, do you have any ideas?
Error info / logs
image

@WZMIAOMIAO
Copy link
Owner

这是因为你没有在my_dataset.py文件中实现获取img_sieze的功能,建议你直接关闭aspect-ratio-group功能。
直接将--aspect-ratio-group-factor值改为-1,关闭此功能

parser.add_argument('--aspect-ratio-group-factor', default=-1, type=int)

@uniyushu
Copy link
Author

uniyushu commented Oct 27, 2020

感谢up,我直接关闭aspect-ratio-group功能,会报RuntimeError: received 0 items of ancdata错误,加入了get_height_and_width功能,将--workers设置为0之后就不用遍历整个数据集了。
def get_height_and_width(self, idx): data = self.img_data[idx] data_height = int(data["heigh"]) data_width = int(data["width"]) return data_height, data_width
image

@uniyushu uniyushu reopened this Oct 27, 2020
@WZMIAOMIAO
Copy link
Owner

恩,自己实现下get_height_and_width方法,不让它自动去挨个读取图像然后统计height和width是最好的。

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

2 participants