advimman / lama

🦙 LaMa Image Inpainting, Resolution-robust Large Mask Inpainting with Fourier Convolutions, WACV 2022
https://advimman.github.io/lama-project/
Apache License 2.0
8.12k stars 861 forks source link

Fix tuple error, mentioned in some of the issues #289

Open ankuPRK opened 10 months ago

ankuPRK commented 10 months ago

Summary

Issues

https://github.com/advimman/lama/issues/274 https://github.com/advimman/lama/issues/167

Problem

In the lama-regular model, the latent feature is a single Tensor, while in lama-fourier and big-lama, the latent feature is a tuple of two tensors. In our refinement code, we assumed the feature to be a tuple.

Solution

This PR adds a function that adapts the feature appropriately. We can't just keep it as-it-is because when Pytorch optimizers (like Adam) don't take a tuple as input.

Visual Results