Perform 1 epoch of training with batch
(args, data_loaders, model, hwf, half_res, device, **render_kwargs_test)
| 206 | return iter_loss, iter_psnr |
| 207 | |
| 208 | def eval_on_epoch(args, data_loaders, model, hwf, half_res, device, **render_kwargs_test): |
| 209 | ''' Perform 1 epoch of training with batch ''' |
| 210 | model.eval() |
| 211 | batch_size = 1 |
| 212 | |
| 213 | train_dl, val_dl, test_dl = data_loaders |
| 214 | |
| 215 | total_loss = [] |
| 216 | total_psnr = [] |
| 217 | |
| 218 | #### Core optimization loop ##### |
| 219 | for data, pose, img_idx in val_dl: |
| 220 | # training one step with batch_size = args.batch_size |
| 221 | loss, psnr = eval_on_batch(args, data, model, pose, img_idx, hwf, half_res, device, **render_kwargs_test) |
| 222 | total_loss.append(loss.item()) |
| 223 | total_psnr.append(psnr.item()) |
| 224 | total_loss_mean = np.mean(total_loss) |
| 225 | total_psnr_mean = np.mean(total_psnr) |
| 226 | return total_loss_mean, total_psnr_mean |
| 227 | |
| 228 | def train_on_batch(args, data, model, pose, img_idx, hwf, optimizer, half_res, device, **render_kwargs_test): |
| 229 | ''' Perform 1 step of training''' |
no test coverage detected