python加载json(传递config里面的超参数)

(1) 首先想到pandas

import pandas as pd
config_path =pd.read_json('/Users/dudu/Desktop/keras1/config.json')
print(config_path)

如下图所示:很多属性读成了NAN
这里写图片描述
(二) python自带的json包

import json

with open("config.json", 'r') as f:
    result = json.load(f)
    print(result)

读取参数为:
{'model': {'min_input_size': 288, 'max_input_size': 448, 'anchors': [180, 155, 232, 229, 254, 307, 286, 168, 310, 265, 321, 353, 334, 216, 369, 300, 387, 376], 'labels': ['Benz_c', 'Benz_g', 'Toyota_PRADO']},

猜你喜欢

转载自blog.csdn.net/qq_37879432/article/details/80356464