PaddlePaddle / PaddleX

All-in-One Development Tool based on PaddlePaddle(飞桨低代码开发工具)
Apache License 2.0
4.94k stars 968 forks source link

模型裁剪时出现“IndexError: list index out of range” #793

Open SUPERSCHOLARYUN opened 3 years ago

SUPERSCHOLARYUN commented 3 years ago

2021-05-31 19:41:13 [INFO] Start to evaluating(total_samples=688, total_steps=86)... 100%|██████████████████████████████████████████████████████████████████████████████████████████████| 86/86 [06:37<00:00, 4.62s/it] Traceback (most recent call last): File "params_analysis.py", line 14, in model=model, dataset=eval_dataset, batch_size=8, save_file='yolov3.sensi.data') File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlex/cv/models/slim/prune.py", line 298, in analysis model, eval_dataset=dataset, batch_size=batch_size, save_file=save_file) File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlex/cv/models/slim/prune.py", line 292, in cal_params_sensitivities scope=model.scope) File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlex/cv/models/slim/prune.py", line 60, in sensitivity baseline = eval_func(graph.program) File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlex/cv/models/slim/prune.py", line 281, in eval_for_prune return_details=False) File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlex/cv/models/ppyolo.py", line 450, in evaluate results, metric, eval_dataset.coco_gt, with_background=False) File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlex/cv/models/utils/detection_eval.py", line 82, in eval_results map_type=map_type) File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlex/cv/models/utils/detection_eval.py", line 542, in voc_bbox_eval detection_map.update(bbox, gt_box, gt_label, difficult) File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlex/cv/models/utils/detection_eval.py", line 712, in update self.class_score_poss[int(label)].append([score, 0.0]) IndexError: list index out of range

FlyingQianMM commented 3 years ago

麻烦贴下运行脚本

SUPERSCHOLARYUN commented 3 years ago

麻烦贴下运行脚本

import os os.environ['CUDA_VISIBLE_DEVICES'] = '0' import paddlex as pdx

model = pdx.load_model('work/YOLOv3/best_model')

eval_dataset = pdx.datasets.VOCDetection( data_dir='work/voc_from_mot20', file_list='work/voc_from_mot20/val_list.txt', label_list='work/voc_from_mot20/labels.txt', transforms=model.eval_transforms)

pdx.slim.prune.analysis( model, dataset=eval_dataset, batch_size=8, save_file='yolov3.sensi.data')

FlyingQianMM commented 3 years ago

labels.txt里面是只有'persion'一个类别?训练的时候也是使用的这份数据集吗?另外paddlex的版本号是多少

SUPERSCHOLARYUN commented 3 years ago

labels.txt里面是只有'persion'一个类别?训练的时候也是使用的这份数据集吗?另外paddlex的版本号是多少

多谢点醒!!!我知道问题在哪了