WuJie1010 / Facial-Expression-Recognition.Pytorch

A CNN based pytorch implementation on facial expression recognition (FER2013 and CK+), achieving 73.112% (state-of-the-art) in FER2013 and 94.64% in CK+ dataset
MIT License
1.78k stars 545 forks source link

Runtime error when compiling visualize .py #59

Closed victor-mageto closed 4 years ago

victor-mageto commented 4 years ago

raise RuntimeError

Attempting to deserialize object on a CUDA device but torch.cuda.is_available() is False. If you are running on a CPU-only machine, please use torch.load with map_location

WuJie1010 commented 4 years ago

Thanks~

victor-mageto commented 4 years ago

I am facing this error while compiling the visualize.py file, what could be the problem

XUSHITINE commented 4 years ago

I am facing this error too.Have u worked out this problem?

lander1003 commented 4 years ago

I am facing this error while compiling the visualize.py file, what could be the problem

you should consider installing pytorch with CUDA

victor-mageto commented 4 years ago

@lander1003 I have installed PyTorch and PyTorchvision for CPU, I don't have CUDA supported GPU in my system.

WuJie1010 commented 4 years ago

@lander1003 I have installed PyTorch and PyTorchvision for CPU, I don't have CUDA supported GPU in my system.

Please refer to https://github.com/WuJie1010/Facial-Expression-Recognition.Pytorch/issues/9

victor-mageto commented 4 years ago

net = VGG('VGG19') checkpoint = torch.load(os.path.join('FER2013_VGG19', 'PrivateTest_model.t7')) device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu') net.load_state_dict(checkpoint['net']) net.to(device) net.eval()

ncrops, c, h, w = np.shape(inputs) inputs = inputs.view(-1, c, h, w) inputs = inputs.to(device) inputs = Variable(inputs) outputs = net(inputs) These changes worked out for me, you can try them on your machine.

ashishksrivastava2 commented 4 years ago

I am still seeing this error and the above code doesnt seem to fix it. anyone else facing the same too?