nischi / MMM-Face-Reco-DNN

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

ImportError #141

Closed mikecheng2626 closed 6 months ago

mikecheng2626 commented 8 months ago

magicmirror@pi:~/MagicMirror/modules/MMM-Face-Reco-DNN $ npm run encode

mmm-face-reco-dnn@2.0.1 encode python tools/encode.py -i dataset -e model/encodings.pickle

Traceback (most recent call last): File "/home/magicmirror/MagicMirror/modules/MMM-Face-Reco-DNN/tools/encode.py", line 4, in import cv2 File "/home/magicmirror/.local/lib/python3.9/site-packages/cv2/init.py", line 181, in bootstrap() File "/home/magicmirror/.local/lib/python3.9/site-packages/cv2/init.py", line 153, in bootstrap native_module = importlib.import_module("cv2") File "/usr/lib/python3.9/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) ImportError: /home/magicmirror/.local/lib/python3.9/site-packages/cv2/cv2.abi3.so: undefined symbol: __atomic_store_8

I did not see a folder named "dataset" I created it on my own.

nischi commented 8 months ago

Hi @mikecheng2626 Yes the folder dataset need to be created with some photos. https://github.com/nischi/MMM-Face-Reco-DNN#face-dataset But maybe i need to create a better error message

mirrormonark commented 8 months ago

magicmirror@pi:~/MagicMirror/modules/MMM-Face-Reco-DNN $ npm run encode

mmm-face-reco-dnn@2.0.1 encode python tools/encode.py -i dataset -e model/encodings.pickle

Traceback (most recent call last): File "/home/magicmirror/MagicMirror/modules/MMM-Face-Reco-DNN/tools/encode.py", line 4, in import cv2 File "/home/magicmirror/.local/lib/python3.9/site-packages/cv2/init.py", line 181, in bootstrap() File "/home/magicmirror/.local/lib/python3.9/site-packages/cv2/init.py", line 153, in bootstrap native_module = importlib.import_module("cv2") File "/usr/lib/python3.9/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) ImportError: /home/magicmirror/.local/lib/python3.9/site-packages/cv2/cv2.abi3.so: undefined symbol: __atomic_store_8

I did not see a folder named "dataset" I created it on my own.

I have the same problem now. did you manage to solve it? @mikecheng2626

TroyesDev commented 8 months ago

Hi guys, same problem here, created the folder as told and everything else as per the instructions and same error

nischi commented 8 months ago

so you created a folder with name dataset with some subfolder with your names and inside of this named folders some pictures to learn?

mirrormonark commented 8 months ago

goodmorning and yes

nischi commented 8 months ago

can you tell me which kind of image do you have? png, jpg, tiff.... and maybe which resolution they have?

mirrormonark commented 8 months ago

i took all the photos with the pi-camera using "raspistill -o name.jpg" and saved them to a dataset subfolder with the person's name.after i changed the name file jpg with "img01" at "img15" how say the readme. the saved photos are in jpg format.

nischi commented 8 months ago

do you have the filename with a file extension .jpg? or only img01?

mirrormonark commented 8 months ago

i open the folder "dataset" then i open the folder "Skywalker"(name of person in that photo) after i see the file name img01.jpg and its extension is jpg.

nischi commented 8 months ago

hmm i will try it again on my pi

mirrormonark commented 8 months ago

my raspberry :

TroyesDev commented 8 months ago

Same as @mirrormonark , I took some photos in .jpg format, created a dataset folder, a subfolder and named the pictures "img01.jpg" and so on... and am facing the exact same error. Will post info on my system tonight if it might help. Thanks for taking some of your free time to help !

nischi commented 8 months ago

Sorry for the late answer. I broke my Pi 🙈

Now i tried it with my new pi and it works just fine. I found an issue on opencv https://github.com/pyinstaller/pyinstaller/issues/6964 with this error. It seems a little bit that the install is corrupt. Seems this happen in some versions of opencv

Do you know which version of open cv do you have installed?

TroyesDev commented 7 months ago

Thanks you for coming back to us mate ! I was using latest release of opencv (4.8 something), downgrading to latest 4.7 release permitted me to run encode. However when rebooting after adding on config.js i had my classes working but no recognition at all so I tried manually running the recognition in a terminal and ended up having the following message "error on cv2 Waitkey(1) the fonction is not implemented". I tried upgrading to 4.8 again and am facing the previous error once again but this time on recognition.py . Seems like last version of opencv is the problem but I can't run recognition on previous one either. Once again thanks for taking your time to help us !

nischi commented 7 months ago

hmm.. properly it is really not enough to install the opencv-python-headless. Can you please install in your virtual environment also pip install opencv-pyhton and try again?

TroyesDev commented 7 months ago

Alrighty so I think I found the problem because everything is working smoothly as hell now. Thing is I had both opencv python and opencv python headless. I just did a pip uninstall on both, then pip install opencv-python==4.7.0 and voila ! Hope this will solve it for you too @mirrormonark . Thanks @nischi