nischi / MMM-Face-Reco-DNN

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

how opencv and how install dependencies? #143

Closed mirrormonark closed 8 months ago

mirrormonark commented 8 months ago

hello i really like your module and would like to try it. i use a raspberry pi 4 and a pi camera (noir). i would like to figure out how to install opencv and as much as google is my friend there are different solutions on the net and in none of them i was able to get your module to work. i tried opencv 4.8 and the 4. 5, probably wrong way to install. i also have many friends and not (telegram fans) who would like to try your module but found problems trying to install the dependencies and if only you could put in the readme a link to install the various dependencies that would be great.

nischi commented 8 months ago

Hi @mirrormonark It should not be a big deal to install the needed dependencies. You will find a install description in my readme. Follow it step by step and you should be able to install my module. https://github.com/nischi/MMM-Face-Reco-DNN#installation

The last step say pip install face-recognition numpy dlib picamera2 opencv-python-headless which install opencv as you needed.

mirrormonark commented 8 months ago

good afternoon.

i try, i have make a picture in folder dataset (i create this folder) but now im stop here. ~/MagicMirror/modules/MMM-Face-Reco-DNN/tools $ 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/xxxxxx/.local/lib/python3.9/site-packages/numpy/core/init.py", line 24, in from . import multiarray File "/home/xxxxxxxx/.local/lib/python3.9/site-packages/numpy/core/multiarray.py", line 10, in from . import overrides File "/home/xxxxx/.local/lib/python3.9/site-packages/numpy/core/overrides.py", line 8, in from numpy.core._multiarray_umath import ( ImportError: libopenblas.so.0: cannot open shared object file: No such file or directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/xxxxx/.local/lib/python3.9/site-packages/numpy/init.py", line 130, in from numpy.config import show as show_config File "/home/xxxxx/.local/lib/python3.9/site-packages/numpy/config.py", line 4, in from numpy.core._multiarray_umath import ( File "/home/xxxxx/.local/lib/python3.9/site-packages/numpy/core/init.py", line 50, in raise ImportError(msg) ImportError:

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the numpy C-extensions failed. This error can happen for many reasons, often due to issues with your setup or how NumPy was installed.

We have compiled some common reasons and troubleshooting tips at:

https://numpy.org/devdocs/user/troubleshooting-importerror.html

Please note and check the following:

and make sure that they are the versions you expect. Please carefully study the documentation linked above for further help.

Original error was: libopenblas.so.0: cannot open shared object file: No such file or directory

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/home/xxxxx/MagicMirror/modules/MMM-Face-Reco-DNN/tools/encode.py", line 2, in import face_recognition File "/home/xxxxxx/.local/lib/python3.9/site-packages/face_recognition/init.py", line 7, in from .api import load_image_file, face_locations, batch_face_locations, face_landmarks, face_encodings, compare_faces, face_distance File "/home/xxxx/.local/lib/python3.9/site-packages/face_recognition/api.py", line 5, in import numpy as np File "/home/xxxx/.local/lib/python3.9/site-packages/numpy/init.py", line 135, in raise ImportError(msg) from e ImportError: Error importing numpy: you should not try to import numpy from its source directory; please exit the numpy source tree, and relaunch your python interpreter from there.

nischi commented 8 months ago

hi @mirrormonark Did you try this? https://numpy.org/devdocs/user/troubleshooting-importerror.html#raspberry-pi

mirrormonark commented 8 months ago

goodmorning, @nischi. yeah i try this, but now i see :

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/xxxxx/MagicMirror/modules/MMM-Face-Reco-DNN/tools/encode.py", line 4, in import cv2 File "/home/xxxxxx/.local/lib/python3.9/site-packages/cv2/init.py", line 181, in bootstrap() File "/home/xxxxx/.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/xxxxxx/.local/lib/python3.9/site-packages/cv2/cv2.abi3.so: undefined symbol: __atomic_store_8

nischi commented 8 months ago

so now you have the same issue as #141? Then i will close this issue here.