IntroPR: Face Recognition (Programming Task)

Disclaimer: Dieser Thread wurde aus dem alten Forum importiert. Daher werden eventuell nicht alle Formatierungen richtig angezeigt. Der ursprüngliche Thread beginnt im zweiten Post dieses Threads.

IntroPR: Face Recognition (Programming Task)
Although we shouldn’t change the function createOnlineDatabase(path) in the file Eigenfaces.py I still think it is necessary because the given code results in an index error.

At line 29 labels.append(filenames[n].split("eigenfaces\\")[1].split("_")[0])
I think it should be

labels.append(filenames[n].split("eigenfaces/")[1].split("_")[0])

to let “split()” match.


Looks like the original code was written for a windows os and you’re running it on linux. Just change it back before submitting it.


By the way, Windows very well accepts forward slashes. It’s just the case, as far as I know, that Windows API functions might return backward slashes sometimes. Apart from that, prefer helper methods instead of string operations on filenames, precisely for compatibility and clarity reasons.