dbolya / yolact

A simple, fully convolutional model for real-time instance segmentation.
MIT License
5.01k stars 1.32k forks source link

Error Train using Resnet50 #795

Open ARRARIAKU2 opened 1 year ago

ARRARIAKU2 commented 1 year ago

Traceback (most recent call last): File "train.py", line 505, in train() File "train.py", line 213, in train yolact_net.init_weights(backbone_path=args.save_folder + cfg.backbone.path) File "C:\Users\ALANA\Documents\Belajar\yolact\yolact.py", line 495, in init_weights self.backbone.init_backbone(backbone_path) File "C:\Users\ALANA\Documents\Belajar\yolact\backbone.py", line 143, in init_backbone state_dict = torch.load(path) File "D:\anaconda3\envs\yolact\lib\site-packages\torch\serialization.py", line 713, in load return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args) File "D:\anaconda3\envs\yolact\lib\site-packages\torch\serialization.py", line 905, in _legacy_load return legacy_load(f) File "D:\anaconda3\envs\yolact\lib\site-packages\torch\serialization.py", line 842, in legacy_load storage._storage, storage_offset, numel, stride) RuntimeError: Attempted to set the storage of a tensor on device "cuda:0" to a storage on different device "cpu". This is no longer allowed; the devices must match.

can someone help me about this, i cant train using resnet50

rajuptvs commented 1 year ago

Hey, hope you are doing good. I faced the same issue. Try this, Go to backbone.py and change the code from : state_dict = torch.load(path)

to state_dict = torch.load(path,map_location='cuda:0').

This should essentially solve the issue.

ARRARIAKU2 commented 1 year ago

Hey, hope you are doing good. I faced the same issue. Try this, Go to backbone.py and change the code from : state_dict = torch.load(path)

to state_dict = torch.load(path,map_location='cuda:0').

This should essentially solve the issue.

Heyy @rajuptvs , thanks for the help If i can ask something again, do you know how to show the IoU?