Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Illegal instruction (core dumped) #620

Closed
ivf777 opened this issue Jun 1, 2017 · 7 comments
Closed

Illegal instruction (core dumped) #620

ivf777 opened this issue Jun 1, 2017 · 7 comments

Comments

@ivf777
Copy link

ivf777 commented Jun 1, 2017

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
<I ran in a virtual environment "py3_dlib" these commands>
pip install numpy
pip install scipy
pip install scikit-image

pip install dlib

  1. I run python in terminal

import sys
import dlib
from skimage import io

detector = dlib.get_frontal_face_detector()
win = dlib.image_window()

output:
Illegal instruction (core dumped)

  1. I run python in terminal

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).

@davisking
Copy link
Owner

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.

@ivf777
Copy link
Author

ivf777 commented Jun 2, 2017

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).

  1. sudo apt-get update
  2. sudo apt-get upgrade

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

Install OpenCV, Lubuntu 16.04 (in VirtualBox)

  1. sudo apt-get install build-essential cmake pkg-config
  2. sudo apt-get install libjpeg8-dev libtiff5-dev libjasper-dev libpng12-dev
  3. sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
  4. sudo apt-get install libxvidcore-dev libx264-dev
  5. sudo apt-get install libgtk-3-dev
  6. sudo apt-get install libatlas-base-dev gfortran
  7. sudo apt-get install python2.7-dev python3.5-dev
  8. sudo apt-get install libx11-dev
  9. sudo apt-get -y install libopencv-dev build-essential cmake git libgtk2.0-dev pkg-config python-dev python-numpy libdc1394-22 libdc1394-22-dev libjpeg-dev libpng12-dev libjasper-dev libavcodec-dev libavformat-dev libswscale-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libv4l-dev libtbb-dev libqt4-dev libfaac-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev x264 v4l-utils unzip
  10. mkdir opencv
  11. cd opencv
  12. wget https://github.com/Itseez/opencv/archive/3.2.0.zip -O opencv-3.2.0.zip
  13. unzip opencv-3.2.0.zip
  14. cd opencv-3.2.0
  15. mkdir build
  16. cd build
  17. cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D WITH_V4L=ON -D WITH_QT=ON -D WITH_OPENGL=ON ..
  18. make -j $(nproc)
  19. sudo make install
  20. sudo /bin/bash -c 'echo "/usr/local/lib" > /etc/ld.so.conf.d/opencv.conf'
  21. sudo ldconfig

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.

@davisking
Copy link
Owner

I don't know why print() doesn't work for you, but it doesn't have anything to do with dlib.

@davisking
Copy link
Owner

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.

@ivf777
Copy link
Author

ivf777 commented Jun 3, 2017

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).

The easiest solution is to download dlib and compile it yourself. But when you do that, you need to make one change.

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.

@davisking
Copy link
Owner

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?

@ivf777
Copy link
Author

ivf777 commented Jun 3, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants