从 Uber Ludwig 中的图像发出训练模型
Issue Training Model From Images in Uber Ludwig
执行我的训练 python 脚本时,返回以下内容。
Traceback (most recent call last):
File "train.py", line 14, in <module>
train_stats = model.train(data_csv="./dataset.csv")
File "/home/user/.local/lib/python3.7/site-packages/ludwig/api.py", line 441, in train
debug=debug,
File "/home/user/.local/lib/python3.7/site-packages/ludwig/train.py", line 252, in full_train
random_seed=random_seed
File "/home/user/.local/lib/python3.7/site-packages/ludwig/data/preprocessing.py", line 403, in preprocess_for_training
random_seed
File "/home/user/.local/lib/python3.7/site-packages/ludwig/data/preprocessing.py", line 525, in _preprocess_csv_for_training
random_seed=random_seed
File "/home/user/.local/lib/python3.7/site-packages/ludwig/data/preprocessing.py", line 62, in build_dataset
**kwargs
File "/home/user/.local/lib/python3.7/site-packages/ludwig/data/preprocessing.py", line 83, in build_dataset_df
global_preprocessing_parameters
File "/home/user/.local/lib/python3.7/site-packages/ludwig/data/preprocessing.py", line 116, in build_metadata
feature['preprocessing']
File "/home/user/.local/lib/python3.7/site-packages/ludwig/utils/misc.py", line 97, in merge_dict
for k, v in merge_dct.items():
AttributeError: 'list' object has no attribute 'items'
我查看了 ludwig 的文档,并对此感到困惑。
from ludwig.api import LudwigModel
model_definition = {
"input_features":[
{"name":"image_path", "type":"image", "preprocessing":[{"height": "128", "width": "128"}],"resize_method": "interpolate"}
],
"output_features":[
{"name":"plate","type":"text"}
]
}
model = LudwigModel(model_definition)
train_stats = model.train(data_csv="./dataset.csv")
我的 CSV 源格式如下。
image_path, plate
./crop_m1/I00000.png, 9B52145
./crop_h1/I00000.png, 9B52145
./crop_m1/I00001.png, 6B94558
./crop_h1/I00001.png, 6B94558
./crop_m1/I00002.png, 8B90164
./crop_h1/I00002.png, 8B90164
./crop_m1/I00003.png, 5B11181
./crop_h1/I00003.png, 5B11181
./crop_m1/I00004.png, 8B79697
./crop_h1/I00004.png, 8B79697
./crop_m1/I00005.png, 8B90164
路德维希的预期行为是无误地训练模型。
你的 pre-proccesing 应该是字典而不是列表: 你有:
"preprocessing":[{"height": "128", "width": "128"}]
应该是:
"preprocessing":{"height": "128", "width": "128"}