hila-chefer / TargetCLIP

[ECCV 2022] Official PyTorch implementation of the paper Image-Based CLIP-Guided Essence Transfer.
232 stars 27 forks source link

Efficiency: no recalculation of original latents needed #5

Closed NotNANtoN closed 2 years ago

NotNANtoN commented 2 years ago

https://github.com/hila-chefer/TargetCLIP/blob/b5dd2a492bf436fa26cfa4c02021a957b6a2a5ec/optimization/find_dirs.py#L142-L144

In these lines the latents are recalculated in the nested loop in every inner loop. The latents themselves stay constant though, so it can be done once outside of these loops. Only the augmented latents (latents + direction) need to be recalculated here.

hila-chefer commented 2 years ago

Hi @NotNANtoN, thanks for your interest in our work! you are of course correct, it can be done for efficiency, but the contribution of this fix to the overall runtime is relatively small. Optimizing a single direction takes around 10 minutes either way :)

hila-chefer commented 2 years ago

@NotNANtoN closing this due to duplication, please reopen if necessary :)