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

TypeError: h5py objects cannot be pickled #69

Closed deepak-kumar-guntupu closed 4 years ago

deepak-kumar-guntupu commented 4 years ago

Traceback (most recent call last): File "mainpro_FER.py", line 223, in main() File "mainpro_FER.py", line 214, in main train(epoch) File "mainpro_FER.py", line 108, in train for batch_idx, (inputs, targets) in enumerate(trainloader): File "C:\Users\guntu\Anaconda3\envs\project\lib\site-packages\torch\utils\data\dataloader.py", line 279, in iter return _MultiProcessingDataLoaderIter(self) File "C:\Users\guntu\Anaconda3\envs\project\lib\site-packages\torch\utils\data\dataloader.py", line 719, in init w.start() File "C:\Users\guntu\Anaconda3\envs\project\lib\multiprocessing\process.py", line 105, in start self._popen = self._Popen(self) File "C:\Users\guntu\Anaconda3\envs\project\lib\multiprocessing\context.py", line 223, in _Popen return _default_context.get_context().Process._Popen(process_obj) File "C:\Users\guntu\Anaconda3\envs\project\lib\multiprocessing\context.py", line 322, in _Popen return Popen(process_obj) File "C:\Users\guntu\Anaconda3\envs\project\lib\multiprocessing\popen_spawn_win32.py", line 65, in init reduction.dump(process_obj, to_child) File "C:\Users\guntu\Anaconda3\envs\project\lib\multiprocessing\reduction.py", line 60, in dump ForkingPickler(file, protocol).dump(obj) File "C:\Users\guntu\Anaconda3\envs\project\lib\site-packages\h5py_hl\base.py", line 308, in getnewargs raise TypeError("h5py objects cannot be pickled") TypeError: h5py objects cannot be pickled

can someone guide me through this error?

ghost commented 4 years ago

It is easy. 1.In 'mainpro_FER.py' line 58,60&62, use"num_workers=0" instead Then you will meet another error:'invalid index of a 0-dim tensor. Use tensor.item() to convert a 0-dim tensor to a Python number' 2.In 'mainpro_FER.py' line 119,147&188, use"train_loss += loss.item()" instead