(texture)
| 366 | return end_lr + 0.5 * (start_lr - end_lr) * (1 + np.cos(np.pi * step / total_steps)) |
| 367 | |
| 368 | def tv_loss(texture): |
| 369 | return torch.nn.functional.l1_loss(texture[:, :-1, :, :], texture[:, 1:, :, :]) + \ |
| 370 | torch.nn.functional.l1_loss(texture[:, :, :-1, :], texture[:, :, 1:, :]) |
| 371 | |
| 372 | total_steps = 2500 |
| 373 | with tqdm(total=total_steps, disable=not verbose, desc='Texture baking (opt): optimizing') as pbar: |