MCPcopy Index your code
hub / github.com/ActiveVisionLab/DFNet / eval_on_epoch

Function eval_on_epoch

script/dm/direct_pose_model.py:208–226  ·  view source on GitHub ↗

Perform 1 epoch of training with batch

(args, data_loaders, model, hwf, half_res, device, **render_kwargs_test)

Source from the content-addressed store, hash-verified

206 return iter_loss, iter_psnr
207
208def 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
228def train_on_batch(args, data, model, pose, img_idx, hwf, optimizer, half_res, device, **render_kwargs_test):
229 ''' Perform 1 step of training'''

Callers 1

train_nerf_trackingFunction · 0.70

Calls 1

eval_on_batchFunction · 0.70

Tested by

no test coverage detected