Lam1360 / YOLOv3-model-pruning

在 oxford hand 数据集上对 YOLOv3 做模型剪枝(network slimming)
MIT License
1.67k stars 431 forks source link

执行test_prune.py出错,为了节省时间,我只用了100个数据进行测试,结果出问题 #83

Open zhousaYolo opened 4 years ago

zhousaYolo commented 4 years ago

Detecting objects: 33%|█████████████████████▋ | 1/3 [00Detecting objects: 67%|███████████████████████████████████████████▎ Detecting objects: 100%|████████████████████████████████████████████████Detecting objects: 100%|█████████████████████████████████████████████████████████████████| 3/3 [00:08<00:00, 2.80s/it] Computing AP: 100%|██████████████████████████████████████████████████ ████████████████████████████| 1/1 [00:00<?, ?it/s] Threshold should be less than 1.0462. The corresponding prune ratio is 0.809. Channels with Gamma value less than 0.9731 are pruned! Detecting objects: 33%|█████████████████████▋ | 1/3 [00Detecting objects: 67%|███████████████████████████████████████████▎ Detecting objects: 100%|████████████████████████████████████████████████Detecting objects: 100%|█████████████████████████████████████████████████████████████████| 3/3 [00:07<00:00, 2.63s/it] Traceback (most recent call last): File "test_prune.py", line 78, in threshold = prune_and_eval(model, sorted_bn, percent) File "test_prune.py", line 69, in prune_and_eval mAP = eval_model(model_copy)[2].mean() File "test_prune.py", line 27, in nms_thres=0.5, img_size=model.img_size, batch_size=4) File "D:\PycharmProjects\YOLOv3-model-pruning-master\test.py", line 55, in evaluate assert sample_metrics != []

Waynepoo commented 4 years ago

我也遇到同样的问题,请问楼主解决了吗?

BinZheng1-pp commented 3 years ago

我原来也报这个错。 把test_prune.py里的precent调小试试看。

LiuRJun commented 3 years ago

Detecting objects: 33%|█████████████████████▋ | 1/3 [00Detecting objects: 67%|███████████████████████████████████████████▎ Detecting objects: 100%|████████████████████████████████████████████████Detecting objects: 100%|█████████████████████████████████████████████████████████████████| 3/3 [00:08<00:00, 2.80s/it] Computing AP: 100%|██████████████████████████████████████████████████ ████████████████████████████| 1/1 [00:00<?, ?it/s] Threshold should be less than 1.0462. The corresponding prune ratio is 0.809. Channels with Gamma value less than 0.9731 are pruned! Detecting objects: 33%|█████████████████████▋ | 1/3 [00Detecting objects: 67%|███████████████████████████████████████████▎ Detecting objects: 100%|████████████████████████████████████████████████Detecting objects: 100%|█████████████████████████████████████████████████████████████████| 3/3 [00:07<00:00, 2.63s/it] Traceback (most recent call last): File "test_prune.py", line 78, in threshold = prune_and_eval(model, sorted_bn, percent) File "test_prune.py", line 69, in prune_and_eval mAP = eval_model(model_copy)[2].mean() File "test_prune.py", line 27, in nms_thres=0.5, img_size=model.img_size, batch_size=4) File "D:\PycharmProjects\YOLOv3-model-pruning-master\test.py", line 55, in evaluate assert sample_metrics != []

Detecting objects: 33%|█████████████████████▋ | 1/3 [00Detecting objects: 67%|███████████████████████████████████████████▎ Detecting objects: 100%|████████████████████████████████████████████████Detecting objects: 100%|█████████████████████████████████████████████████████████████████| 3/3 [00:08<00:00, 2.80s/it] Computing AP: 100%|██████████████████████████████████████████████████ ████████████████████████████| 1/1 [00:00<?, ?it/s] Threshold should be less than 1.0462. The corresponding prune ratio is 0.809. Channels with Gamma value less than 0.9731 are pruned! Detecting objects: 33%|█████████████████████▋ | 1/3 [00Detecting objects: 67%|███████████████████████████████████████████▎ Detecting objects: 100%|████████████████████████████████████████████████Detecting objects: 100%|█████████████████████████████████████████████████████████████████| 3/3 [00:07<00:00, 2.63s/it] Traceback (most recent call last): File "test_prune.py", line 78, in threshold = prune_and_eval(model, sorted_bn, percent) File "test_prune.py", line 69, in prune_and_eval mAP = eval_model(model_copy)[2].mean() File "test_prune.py", line 27, in nms_thres=0.5, img_size=model.img_size, batch_size=4) File "D:\PycharmProjects\YOLOv3-model-pruning-master\test.py", line 55, in evaluate assert sample_metrics != []

调试发现,outputs = model(imgs)的输出中outputs的结果为none。所以,导致sample_metrics为空。但是,有没有哪位能解释下原因