data与feed_list不匹配
Created by: zq19
这是出错信息: Traceback (most recent call last) in 1 if name == 'main': 2 init_log_config() ----> 3 train() in train() 52 print(data['image'][0]) 53 loss, acc1, pred_ot = exe.run(train_program, ---> 54 feed=feeder.feed(data), 55 fetch_list=train_fetch_list) 56 print(loss,acc1) /opt/conda/envs/python35-paddle120-env/lib/python3.5/site-packages/paddle/fluid/data_feeder.py in feed(self, iterable) 280 assert len(each_sample) == len(converter), ( 281 "The number of fields in data (%s) does not match " + --> 282 "len(feed_list) (%s)") % (len(each_sample), len(converter)) 283 for each_converter, each_slot in six.moves.zip(converter, 284 each_sample): AssertionError: The number of fields in data (5) does not match len(feed_list) (2) 我的data信息: len(data)=2 data.keys()=['image','label'] data['image'][0]:dim: 1, 3, 224, 224 layout: NCHW dtype: float data: [0.00392157 ............]
data['label']:lod: {} dim: 30, 1 layout: NCHW dtype: int64_t data: [0 0 0 0 0 0 2 0 0 0 0 4 0 2 0 0 0 4 0 0 0 4 0 2 2 1 2 0 0 0]
这里是feed的信息: feeder = fluid.DataFeeder(feed_list=[image, label], place=place,program=train_program) batch_reader = feeder.decorate_reader(paddle.batch(train_data_generator(train_images_dir), batch_size=30, drop_last=True),multi_devices=False)