nischi / MMM-Face-Reco-DNN

Face recognition with opencv and deep neural network
MIT License
91 stars 46 forks source link

Question: Creating encoding.pickles on Windows #66

Closed ChrizZz90 closed 3 years ago

ChrizZz90 commented 3 years ago

I tried to create the encoding.pickle with Visual Code on my Windows10 laptop but it isn't working because of the different way to create paths with backslash instead of slashes. Is there any way to change that, because it would increase the speed of creating encodings by far.

I saw yesterday something with posixpath, but I couldn't get it working: https://docs.python.org/3/library/os.path.html#module-os.path

nischi commented 3 years ago

I think this would make sense. But i developed this on my mac. I can try to change it on my windows machine. Or do you have a solution?

ChrizZz90 commented 3 years ago

I don't have a solution yet. I tried a few things but with lack of knowledge, it's more trial and error.

The situation is, that in the MM config file I create classes with the name of the folder, like "chrizzz90". When I create the encoding.pickles on Win10, it looks like this:

imagepath: '../dataset/chrizzz90\chrizzz90_1.jpg' name: '../dataset/chrizzz90'

I guess line 35 of the encode.py is the issue: name = imagePath.split(os.path.sep)[-2]

When I use the pickles created on Win10 the module recognizes me, but it says "Hello ../dataset/chrizzz90" and the classes system won't work. I think it is because of ../dataset/chrizzz90 != chrizzz90

I don't know how the path on a mac looks like, I thought there would be the same issue.

ChrizZz90 commented 3 years ago

Replacing the code in line 35 solved it for me with Win10

current code: name = imagePath.split(os.path.sep)[-2]

new code: name = os.path.basename(os.path.dirname(imagePath))

@nischi can you please check if that works on mac too?

ChrizZz90 commented 3 years ago

70