paddlehub做图像迁移的时候遇到错误
Created by: youkai-dbc
平台:AiStudio 框架:paddle 1.7 paddlehub 1.6.1 项目:图片十分类迁移学习 模型:resnet_v2_50_imagenet 在用paddlehub做图像分类迁移学习的时候,自定义dataset,构建reader时运行显示: [ INFO] - Dataset is None or it has not any labels, label map = {} 在Finetune的时候,报错: AttributeError: 'MyDataSet' object has no attribute 'dev_examples' 详细错误:1 #开始Finetune ----> 2 task.finetune_and_eval() 3 print('over') /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlehub/finetune/task/base_task.py in finetune_and_eval(self) 862 863 def finetune_and_eval(self): --> 864 return self.finetune(do_eval=True) 865 866 def finetune(self, do_eval=False): /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlehub/finetune/task/base_task.py in finetune(self, do_eval) 887 888 # Final evaluation --> 889 if self._base_data_reader.get_dev_examples() != []: 890 # Warning: DO NOT use self.eval(phase="dev", load_best_model=True) during training. 891 # It will cause trainer unable to continue training from checkpoint after eval. /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlehub/reader/base_reader.py in get_dev_examples(self) 26 27 def get_dev_examples(self): ---> 28 return self.dataset.get_dev_examples() 29 30 def get_test_examples(self): /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlehub/dataset/base_cv_dataset.py in get_dev_examples(self) 157 158 def get_dev_examples(self): --> 159 return self.dev_examples 160 161 def get_test_examples(self): AttributeError: 'MyDataSet' object has no attribute 'dev_examples'
自定义文件格式: train_list.txt: 0/IMG_1118.JPG 0 0/IMG_1128.JPG 0 0/IMG_1138.JPG 0 0/IMG_1148.JPG 0 0/IMG_1158.JPG 0 ...... test_list.txt: 0/IMG_5746.JPG 0 0/IMG_5756.JPG 0 0/IMG_5766.JPG 0 0/IMG_5776.JPG 0 0/IMG_5786.JPG 0 ...... validata.txt: 0/IMG_4896.JPG 0 0/IMG_4906.JPG 0 0/IMG_4916.JPG 0 0/IMG_4926.JPG 0 0/IMG_4936.JPG 0 ...... label_list.txt: zero one two three fore five six seven eight nigh
文件中的空格是用python写入的,f.write(' '),试过写入f.write('\t'),f.write('\000'),都不起作用,找不到问题所在