SpursLipu / YOLOv3v4-ModelCompression-MultidatasetTraining-Multibackbone

YOLO ModelCompression MultidatasetTraining
GNU General Public License v3.0
444 stars 136 forks source link

error using detect.py after pruning #85

Closed saeedkhanehgir closed 3 years ago

saeedkhanehgir commented 3 years ago

Hi after pruning and use prune_0.5_percent_last.pt and pruned cfg file for inference by detect.py i get error

Traceback (most recent call last): File "detect.py", line 191, in detect() File "detect.py", line 25, in detect model.load_state_dict(torch.load(weights, map_location=device)['model']) File "/home/saeed/anaconda3/envs/py_torch/lib/python3.8/site-packages/torch/serialization.py", line 529, in load return _legacy_load(opened_file, map_location, pickle_module, pickle_load_args) File "/home/saeed/anaconda3/envs/py_torch/lib/python3.8/site-packages/torch/serialization.py", line 692, in _legacy_load magic_number = pickle_module.load(f, pickle_load_args) _pickle.UnpicklingError: invalid load key, '\x00'.

Does anyone have an idea to fix this error?

ly0303521 commented 3 years ago

@saeedkhanehgir have you solved?

ly0303521 commented 3 years ago

@saeedkhanehgir I found the reason, after I using normal_prune.py, the weights file should end with .weights, but it end with pt, when I using convert.py, the error came out

SpursLipu commented 3 years ago

This bug has already fixed