I follow the instruction to download the backbone files in https://github.com/facebookresearch/VMZ/blob/main/c2/tutorials/model_zoo.md, but the snapshot file of this site is '.pkl' file and your weights path in config/model/backbone/irCSN152.yaml is a '.pth' file,
then:
Traceback (most recent call last):
File "/media/wilson/SD_Data/DE/video_shadow/d2conv3d-main/main.py", line 51, in main
model = SaliencyModel(cfg)
File "/media/wilson/SD_Data/DE/video_shadow/d2conv3d-main/experiments/saliency.py", line 24, in __init__
self.model = build_network(hparams.model)
File "/media/wilson/SD_Data/DE/video_shadow/d2conv3d-main/utils/construct.py", line 44, in build_network
return retrieve("network", cfg.name)(cfg)
File "/media/wilson/SD_Data/DE/video_shadow/d2conv3d-main/network/segmentation/encoder_decoder.py", line 17, in __init__
backbone = build_backbone(cfg.backbone)
File "/media/wilson/SD_Data/DE/video_shadow/d2conv3d-main/utils/construct.py", line 62, in build_backbone
load_weights(
File "/media/wilson/SD_Data/DE/video_shadow/d2conv3d-main/utils/util.py", line 144, in load_weights
state_dict = torch.load(weights_path, map_location="cpu", encoding="utf-8")
File "/home/wilson/anaconda3/envs/d2conv3d/lib/python3.8/site-packages/torch/serialization.py", line 713, in load
return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
File "/home/wilson/anaconda3/envs/d2conv3d/lib/python3.8/site-packages/torch/serialization.py", line 920, in _legacy_load
magic_number = pickle_module.load(f, **pickle_load_args)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xde in position 0: invalid continuation byte
Set the environment variable HYDRA_FULL_ERROR=1 for a complete stack trace.
and I have tried to revise the line 84 in utils/util.py:
state_dict = torch.load(weights_path, map_location="cpu")
to
state_dict = torch.load(weights_path, map_location="cpu",, encoding="latin1")
something wrong:
Traceback (most recent call last):
File "/media/wilson/SD_Data/DE/video_shadow/d2conv3d-main/main.py", line 51, in main
model = SaliencyModel(cfg)
File "/media/wilson/SD_Data/DE/video_shadow/d2conv3d-main/experiments/saliency.py", line 24, in __init__
self.model = build_network(hparams.model)
File "/media/wilson/SD_Data/DE/video_shadow/d2conv3d-main/utils/construct.py", line 44, in build_network
return retrieve("network", cfg.name)(cfg)
File "/media/wilson/SD_Data/DE/video_shadow/d2conv3d-main/network/segmentation/encoder_decoder.py", line 17, in __init__
backbone = build_backbone(cfg.backbone)
File "/media/wilson/SD_Data/DE/video_shadow/d2conv3d-main/utils/construct.py", line 62, in build_backbone
load_weights(
File "/media/wilson/SD_Data/DE/video_shadow/d2conv3d-main/utils/util.py", line 144, in load_weights
state_dict = torch.load(weights_path, map_location="cpu", encoding="latin1")
File "/home/wilson/anaconda3/envs/d2conv3d/lib/python3.8/site-packages/torch/serialization.py", line 713, in load
return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
File "/home/wilson/anaconda3/envs/d2conv3d/lib/python3.8/site-packages/torch/serialization.py", line 922, in _legacy_load
raise RuntimeError("Invalid magic number; corrupt file?")
RuntimeError: Invalid magic number; corrupt file?
Set the environment variable HYDRA_FULL_ERROR=1 for a complete stack trace.
It seems can be only read by
with open(weights_path, "rb") as f:
caffe2_checkpoint = pickle.load(f, encoding="latin1")
How can I use this '.pkl' file?