danduncan / HappyNet

Convolutional neural network that does real-time emotion recognition. HappyNet detects faces in video and images, classifies the emotion on each face, then replaces each face with the correct emoji for that emotion. Based on Caffe and the "Emotions in the Wild" network available on Caffe model zoo.
https://youtu.be/MDHtzOdnSgA
130 stars 59 forks source link

convert ck+ to jaffe #4

Open wtbsw opened 7 years ago

wtbsw commented 7 years ago

When I convert ck dataset to jaffe format, i have this issue:

Detected 1 faces. Traceback (most recent call last): File "D:\software\work\Caffe\models\HappyNet-master\HappyNet-master\CKPlus_convert_to_Jaffe_format.py", line 64, in input_list = faceCrop(dirCrop, input_list, color, single_face) File "D:\software\work\Caffe\models\HappyNet-master\HappyNet-master\opencv_functions.py", line 212, in faceCrop cropped_pil_img.save(save_name) File "D:\software\work\Anaconda2\lib\site-packages\PIL\Image.py", line 1725, in save fp = builtins.open(filename, "w+b") IOError: [Errno 2] No such file or directory: 'datasets/CK_Plus/cropped/CKPlus_Images\S005\001\S005_001_00000011_crop1.png' [Finished in 2.8s]

i can not understand why this happen, thank you very mucn for help!

wtbsw commented 7 years ago

I solve the problem, thanks for my insisting. The reason is slash,

this is the line 212 of opencv_function.py save_name = targetDir + '/' + fname.split('/')[-1] + '_crop' + str(n) + ext

when i run the program, windows can not figure /, so i have to change it to \(double \ ,) save_name = targetDir + '/' + fname.split('\')[-1] + '_crop' + str(n) + ext

what is more, we should change line 36 of CKPlus_convert_to_Jaffe_format.py dirCKPlus = 'datasets/CK_Plus' to dirCKPlus = 'datasets/CKPlus' beacause line39 dataset = ckplus