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 infer for images of small size #4

Open
GiannakopoulosIlias opened this issue Jan 9, 2024 · 5 comments
Open

How to infer for images of small size #4

GiannakopoulosIlias opened this issue Jan 9, 2024 · 5 comments

Comments

@GiannakopoulosIlias
Copy link

Hello,

I have a custom datasets of jpgs of a small size (38x47 to be precise).

Is it possible to adjust the network to infer the edges for these images?

If I run without any modifications in the network, I get this error:

File "./DiffusionEdge-main/denoising_diffusion_pytorch/mask_cond_unet.py", line 952, in forward
x = torch.cat((x, h.pop()), dim = 1)
RuntimeError: Sizes of tensors must match except in dimension 1. Expected size 4 but got size 5 for tensor number 1 in the list.

Thanks!

@GuHuangAI
Copy link
Owner

@GiannakopoulosIlias
Hello, I have two suggestions:
(1) Since the model is trained with the image size of 320x320, it can not deal with images that have smaller sizes. Without retraining the model, you can try to resize the smaller images to larger sizes. I guess the performance may be not good.
(2) The better way to obtain correct edges is to retrain the diffusionedge with a crop size of 32x32.
Besides, I'm a little curious what your images look like.

@GiannakopoulosIlias
Copy link
Author

Hello, thanks a lot for the inputs on this.

For (1) I agree that an interpolation might lead it sub-optimal results.
For (2) we have 2D quantitative maps and we can export them to jpgs. Here is how the python plot looks like.
Do you think retraining the network with one of the available datasets would work well for these type of edges? Unfortunately we don't have any ground-truth edge mask.

2024-01-09_14-30

@GuHuangAI
Copy link
Owner

GuHuangAI commented Jan 9, 2024

I think diffusionedge can handle this type of image when training on the similar datasets (small images), however, I don't know if there is such a dataset. If you want to train diffusionedge on this type of dataset (32x32), you do not have to use latent diffusion model, but just train the model in the image space.

@GiannakopoulosIlias
Copy link
Author

I think diffusionedge can handle this type of image when training on the similar datasets (small images), however, I don't know if there is such a dataset. If you want to training diffusion edge on this type of dataset (32x32), you do not have to use latent diffusion model, but just train the model in the image space.

Thanks again! I will experiment a bit further with resizing as it seems simpler for now.

@15634960802
Copy link

我认为 diffusionedge 在类似的数据集(小图像)上训练时可以处理这种类型的图像,但是,我不知道是否有这样的数据集。如果要在这种类型的数据集 (32x32) 上训练扩散边缘,则不必使用潜在扩散模型,而只需在图像空间中训练模型即可。

再次感谢!我将进一步尝试调整大小,因为它现在看起来更简单。

Hello, how did you solve it in the end? I also encountered a similar problem. But I don't have a similar small-sized training dataset

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

3 participants