tanluren / yolov3-channel-and-layer-pruning

yolov3 yolov4 channel and layer pruning, Knowledge Distillation 层剪枝,通道剪枝,知识蒸馏
Apache License 2.0
1.5k stars 446 forks source link

剪枝后的cfg文件创建不了 #131

Open haoxue1215 opened 3 years ago

haoxue1215 commented 3 years ago

Traceback (most recent call last): File "slim_prune.py", line 198, in pruned_cfg_file = write_cfg(pruned_cfg_name, [model.hyperparams.copy()] + compact_module_defs) File "D:\Anaconda3\envs\pytorch\ayolo\YOLOv3v4\utils\prune_utils.py", line 137, in write_cfg with open(cfg_file, 'w') as f: PermissionError: [Errno 13] Permission denied: 'cfg/prune_0.5_keep_0.01_yolov4.cfg'

syswyl commented 3 years ago

Traceback (most recent call last): File "slim_prune.py", line 198, in pruned_cfg_file = write_cfg(pruned_cfg_name, [model.hyperparams.copy()] + compact_module_defs) File "D:\Anaconda3\envs\pytorch\ayolo\YOLOv3v4\utils\prune_utils.py", line 137, in write_cfg with open(cfg_file, 'w') as f: PermissionError: [Errno 13] Permission denied: 'cfg/prune_0.5_keep_0.01_yolov4.cfg'

这个是文件读写的问题,权限不够。

chingi071 commented 3 years ago

可能是因為你資料夾還未創建,因此無法寫入 .cfg 檔,你可以檢查一下資料夾路徑是否正確。 在 slim_prune.py 中 pruned_cfg_name 資料夾路徑確認是否存在,加入以下 cfg_dir_name = os.path.split(pruned_cfg_name)[0] if not os.path.isdir(cfg_dir_name): os.makedirs(cfg_dir_name)

Image 7