自己手写是个错误的选择,因为yaml语法有些讲究。所以直接用代码写。方便快捷
import yaml
import os
current_path = os.path.abspath(".")
yaml_path = os.path.join(current_path, "./gmflow/parameters.yaml")
py_object = {'padding_factor':16,
'resume':'pretrained/gmflow_sintel-0c07dcb3.pth',
'strict_resume':False,
'num_scales':1,
'feature_channels':128,
'upsample_factor':8,
'num_transformer_layers':6,
'num_head':1,
'attention_type':'swin',
'ffn_dim_expansion':4,
'attn_splits_list':[2],
'corr_radius_list':[-1],
'prop_radius_list':[-1],
'local_rank':0,
'inference_size':None,
'save_flo_flow':False,
'dir_paired_data':False,
'pred_bidir_flow':False,
'fwd_bwd_consistency_check':False}
file = open(yaml_path, 'w', encoding='utf-8')
yaml.dump(py_object, file)
file.close()