Closed ivanovd closed 5 years ago
pi@raspberrypi:~ $ workon cv
(cv) pi@raspberrypi:~ $ python
Python 3.5.3 (default, Sep 27 2018, 17:25:39)
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> cv2.__version__
'4.1.0'
Hmm, although my main Python installation is on 2.7 cv2 module seems to be working outside of the virt env:
pi@raspberrypi:~ $ python
Python 2.7.13 (default, Sep 26 2018, 18:42:22)
[GCC 6.3.0 20170516] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> cv2.__version__
'4.1.0'
>>> exit()
Any ideas why the above error is then?
pi@spiegel:~ $ python
Python 2.7.13 (default, Sep 26 2018, 18:42:22)
[GCC 6.3.0 20170516] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> cv2.__version__
'4.1.0'
hmm looks the same to me.
Have you add every config in the module or do you use the default configuration? can you send me the exact config do you have? then i test that on my machine.
Here is the config of the module:
{
module: 'MMM-Face-Reco-DNN',
config: {
// Logout 15 seconds after user was not detecte anymore, if they will be detected between this 15 Seconds, they delay will start again
logoutDelay: 15000,
// How many time the recognition starts, with a RasPi 3+ it would be good every 2 seconds
checkInterval: 2000,
// Module set used for strangers and if no user is detected
defaultClass: 'default',
// Set of modules which should be shown for every user
everyoneClass: 'everyone',
// XML to recognize with haarcascae
cascade: 'modules/MMM-Face-Reco-DNN/tools/haarcascade_frontalface_default.xml',
// Pre encoded pickle with the faces
encodings: 'modules/MMM-Face-Reco-DNN/tools/encodings.pickle',
// You wanna use pi camera or usb / builtin (1 = raspi camera, 0 = other camera)
usePiCamera: 0,
// Method of face detection (dnn = deep neural network, haar = haarcascade)
method: 'dnn',
// Which face detection model to use. "hog" is less accurate but faster on CPUs. "cnn" is a more accurate deep-learning model which is GPU/CUDA accelerated (if available).
detectionMethod: 'hog',
// How fast in ms should the modules hide and show (face effect)
animationSpeed: 0
}
},
I use a PS3 Eye USB camera
I tried symlinking the virtenv module to the outside python3 but that didn't work. If you manage to replicate this and it is a bug then fine, otherwise do not waste your time, I started building OpenCV 4.1 and dlib on a new SD card, once I am ready I will post the results here.
seems python-shell use python3 instead of python. Can you run the same with python3
pi@spiegel:~ $ python3
Python 3.5.3 (default, Sep 27 2018, 17:25:39)
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> cv2.__version__
'4.1.0'
I ran it with python3 and indeed the cv2 module was not linked outside of the virt env. I tried multiple solutions to link them and finally gave up and now I am recompiling and building OpenCV 4.1 on a fresh installation. I will report back when finished. I am really looking forward to testing this.
i read through the documentation of python-shell which i use. maybe it make sense to add a configuration that you can manually set the path to python. so you can use also the virtual env specialy for the face recognition
It would be great if you could do that. Otherwise somebody else who followed the tuttorial at https://www.pyimagesearch.com/2018/09/26/install-opencv-4-on-your-raspberry-pi/ might run into the same issue as me :)
Keep up the great work nischi
@ivanovd Can you test thew new version with the pythonPath options please? Can't really test it on my machine, but should work :)
Edit I have successfully testet it on my mac
I got it to work and WOW ... it is so much better, accurate and fast than Facial_Recognition_OCV3 ... I am really happy with the result.
Great job @nischi
Thanks a lot. If you change detectionMethod
to cnn
it will much more accurate, but it need power. And thats nothing for a pi. Maybe a pi 4, i need to buy one and test :)
I have followed the instructions for compiling and building the OpenCV 4.1, but I did it as per instruction in a virtual enviornment, however MagicMirror is started outside of that virtual enviornment and cv2 is not there and the error that I am getting is:
Can I take "out" cv2 outside of the virtual enviornment or somehow make MagicMirror use that inside of the virt env?