I installed Ubuntu 16.04. And I run these commands in terminal:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential cmake pkg-config
sudo apt-get install libjpeg8-dev libtiff5-dev libjasper-dev libpng12-dev
sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
sudo apt-get install libxvidcore-dev libx264-dev
sudo apt-get install libatlas-base-dev gfortran
sudo apt-get install python2.7-dev python3.5-dev
sudo apt-get install build-essential cmake
sudo apt-get install libgtk-3-dev
sudo apt-get install libboost-all-dev
wget https://bootstrap.pypa.io/get-pip.py
sudo python get-pip.py
mkvirtualenv py3_dlib -p python3
pip install numpy
pip install scipy
pip install scikit-image
import sys
import dlib
from skimage import io
detector = dlib.get_frontal_face_detector()
win = dlib.image_window()
output:
Illegal instruction (core dumped)
import dlib
detector = dlib.get_frontal_face_detector()
image = cv2.imread('/home/mns/Downloads/f24.jpg')
image = imutils.resize(image, width=500)
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
rects = detector(gray,1)
And I have here the same error:
Illegal instruction (core dumped)
What can I do solve this problem?
P.S.
I also created a virtual environment cv2 (installed OpenCV) and a virtual environment keras_tf (installed tensor flow and keras).
You should need libX11-dev. However, I would expect a different error message if that was the problem.
I would try with just one version of python installed and no virtual environments. Just the most basic setup.
Davis, thank you for your answer. I hope that you willl help me to solve this problem. I want to install dlib. I decide to reinstall Ubuntu 16.04 and I created new Lubuntu 16.04 in VirtualBox.
I run these commands in VirtualBox (Lubuntu 16.04).
I made a Snapshot (Snapshot number A)
My next goal - is to install OpenCV becasue I want to use dlib with OpenCV.
I run these commands to install OpenCV
Success, I can run python3 and I can run import cv2. I made the next Snapshot called B
Now goal is to install dlib (in VirtualBox, Lubuntu 16.04)
sudo apt-get install libx11-dev
sudo apt-get install build-essential cmake
sudo apt-get install libgtk-3-dev
sudo apt-get install libboost-all-dev
pip3 install numpy
pip3 install scipy
pip3 install scikit-image
pip3 install dlib
Success, I can run python3 and I can run "import dlib"
Test dlib
pip3 install argparse
pip3 install imutils
sudo apt-get install python-matplotlib
sudo apt-get install python3-tk
Adrian wrote an example with dlib here:http://www.pyimagesearch.com/2017/04/03/facial-landmarks-dlib-opencv-python/ I want to run this example.
So I decide to test this example (to test dlib, in VirtualBox, Lubuntu 16.04)
You can see Screenshot: http://imgur.com/cHwqmez
I run Adrian's example but I did not see any result (I don't see output with image). So I decided to test dlib myself.
You can see this in Screenshot. I run these commands:
python3
import cv2
import dlib
import imutils
detector = dlib.get_frontal_face_detector()
image = cv2.imread("/home/mnt/Kernel/griz.jpg" )
image = imutils.resize(image, width=500)
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
rects = detector(gray, 1)
I don't have now problem with core dumped (it's nice!!!) but I wrote print(help(rects)) and I did not see anything. I wrote print("Hello") and I did not see anything. You can see this in Screenshot.
What can I do to solve this problem?
I have two snapshots in VirtualBox (after installation Lubuntu 16.04 and after installation OpenCV) So if I did something wrong, I can load the snapshot and write other commands to install dlib correctly.
I don't know why print() doesn't work for you, but it doesn't have anything to do with dlib.
I should also point out that you should run the face_detector.py example that comes with dlib. Does that crash or act funny? If not then the problem is almost certainly with some other thing you are doing or have installed, rather than anything related to dlib.
Maybe this is solution:
https://github.com/ageitgey/face_recognition#face-recognition
Common Issues
Issue: Illegal instruction (core dumped) when using face_recognition or running examples.
Solution: dlib is compiled with SSE4 or AVX support, but your CPU is too old and doesn't support that. You'll need to recompile dlib after making the code change outlined here.
The issue is most likely that dlib was compiled with support for AVX and/or SSE4 instructions, but your cpu is too old to support them (pre-2011, I think).
Before compiling dlib, edit dlib's tools/python/CMakeLists.txt file from:
set(USE_SSE4_INSTRUCTIONS ON CACHE BOOL "Use SSE4 instructions")
to:
set(USE_SSE2_INSTRUCTIONS ON CACHE BOOL "Use SSE2 instructions")
And then compile and install dlib and the dlib python extensions. Hopefully that should fix it.
Maybe. Did you run the dlib example program https://github.com/davisking/dlib/blob/master/python_examples/face_detector.py to see if it works?
Davis, I run this example yesterday. I had the error.
But now I installed dlib correctly!!!!
I downloaded dlib here: https://github.com/davisking/dlib/
Before compiling dlib, I edited dlib's tools/python/CMakeLists.txt file from:
set(USE_SSE4_INSTRUCTIONS ON CACHE BOOL "Use SSE4 instructions")
to:
set(USE_SSE2_INSTRUCTIONS ON CACHE BOOL "Use SSE2 instructions")
Then I run
python3 setup.py install
And it worked! You example https://github.com/davisking/dlib/blob/master/python_examples/face_detector.py works and I think that Adrian's example will work too.
Nice!!!! I'm very glad.
Most helpful comment
Davis, I run this example yesterday. I had the error.
But now I installed dlib correctly!!!!
I downloaded dlib here: https://github.com/davisking/dlib/
Before compiling dlib, I edited dlib's tools/python/CMakeLists.txt file from:
set(USE_SSE4_INSTRUCTIONS ON CACHE BOOL "Use SSE4 instructions")
to:
set(USE_SSE2_INSTRUCTIONS ON CACHE BOOL "Use SSE2 instructions")
Then I run
python3 setup.py install
And it worked! You example https://github.com/davisking/dlib/blob/master/python_examples/face_detector.py works and I think that Adrian's example will work too.
Nice!!!! I'm very glad.