You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I set use_gpu=false or CUDA is not available, then I got the following KeyError-
Traceback (most recent call last): File "D:\efficientdet\trainer.py", line 28, in train gtf.Train_Dataset(root_dir=self.dataset_root_dir, File "D:\train_detector.py", line 61, in Train_Dataset "batch_size": self.system_dict["params"]["batch_size"] * self.system_dict["local"]["num_gpus"], KeyError: 'num_gpus'
I tried to fix the problem by initializing these parameters in constructor- self.system_dict["local"]["num_gpus"], self.system_dict["local"]["device"]
class Detector():
def __init__(self, verbose=1):
self.system_dict = {}
self.system_dict["verbose"] = verbose
self.system_dict["local"] = {}
self.system_dict["local"]["num_gpus"] = 1 <- set value as 1
self.system_dict["local"]["device"] = 'cuda' if torch.cuda.is_available() else 'cpu' <- to avoid KeyError: 'device'`
train_detector.py
After that, I got the following errors-
Traceback (most recent call last):
File "c:\users\appdata\local\programs\python\python38\lib\runpy.py", line 192, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\users\appdata\local\programs\python\python38\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "D:\train_detector.py", line 197, in Train
cls_loss, reg_loss = self.system_dict["local"]["model"](
File "D:\site-packages\torch\nn\modules\module.py", line 550, in __call__
result = self.forward(*input, **kwargs)
File "model.py", line 258, in forward
c3, c4, c5 = self.backbone_net(img_batch)
File "D:\site-packages\torch\nn\modules\module.py", line 550, in __call__
result = self.forward(*input, **kwargs)
File "model.py", line 187, in forward
x = self.model._swish(self.model._bn0(self.model._conv_stem(x)))
File "site-packages\torch\nn\modules\module.py", line 550, in __call__
result = self.forward(*input, **kwargs)
File "site-packages\efficientnet_pytorch\utils.py", line 144, in forward
x = F.conv2d(x, self.weight, self.bias, self.stride, self.padding, self.dilation, self.groups)
RuntimeError: Input type (torch.cuda.FloatTensor) and weight type (torch.FloatTensor) should be the same
Is there any solution to train efficiendet-b0 model in CPU?
The text was updated successfully, but these errors were encountered:
If I set use_gpu=false or CUDA is not available, then I got the following KeyError-
Traceback (most recent call last): File "D:\efficientdet\trainer.py", line 28, in train gtf.Train_Dataset(root_dir=self.dataset_root_dir, File "D:\train_detector.py", line 61, in Train_Dataset "batch_size": self.system_dict["params"]["batch_size"] * self.system_dict["local"]["num_gpus"], KeyError: 'num_gpus'
I tried to fix the problem by initializing these parameters in constructor-
self.system_dict["local"]["num_gpus"]
,self.system_dict["local"]["device"]
After that, I got the following errors-
Is there any solution to train efficiendet-b0 model in CPU?
The text was updated successfully, but these errors were encountered: