in src/evaluate.py [0:0]
def evaluate(train_config, reference_video, evaluations):
if not hasattr(train_config, 'outDir'):
train_config.outDir = train_config.logDir
if "opt" in evaluations and not train_config.config_file.trainWithGTDepth:
print(f"Rendering _opt.mp4")
train_config.store_camera_options()
train_config.config_file.camPath = "cam_path"
train_config.config_file.camType = "PredefinedCamera"
train_config.config_file.videoFrames = -1
render_video(train_config, vid_name="_opt", out_dir=train_config.outDir)
train_config.restore_camera_options()
# get network size
if "complexity" in evaluations:
get_network_size(train_config)
with torch.cuda.device(train_config.device):
torch.cuda.empty_cache()
# get image data
if "images" in evaluations:
generate_data(train_config, evaluations)
with torch.cuda.device(train_config.device):
torch.cuda.empty_cache()
# get video data
if "videos" in evaluations and not train_config.config_file.trainWithGTDepth:
generate_data(train_config, evaluations, reference_video)
if "output_videos" in evaluations and not train_config.config_file.trainWithGTDepth:
# Overwrite the "video" names in the train_config with the requested video names
if train_config.evaluation_cam_path is not None and len(train_config.evaluation_cam_path) > 0:
for cam_path in train_config.evaluation_cam_path:
print(f"Rendering output video {cam_path}")
train_config.store_camera_options()
train_config.config_file.camPath = cam_path
train_config.config_file.camType = "PredefinedCamera"
train_config.config_file.videoFrames = -1
render_video(train_config, vid_name=cam_path, out_dir=train_config.outDir)
train_config.restore_camera_options()
else:
print("Warning: output_videos was supplied for evaluation but no camera path (--camPath) was supplied!")
if "export" in evaluations:
export_onnx(train_config=train_config, out_dir=os.path.join(train_config.outDir, 'exported_model'))
# copy opt.txt to eval folder to signify completed evaluation
if os.path.exists(os.path.join(train_config.logDir, "opt.txt")):
copyfile(os.path.join(train_config.logDir, "opt.txt"), os.path.join(train_config.outDir, "eval", "opt.txt"))