mjszczep / PyStasm

Python wrapper for finding features in faces.
Other
17 stars 6 forks source link

Segmentation fault (core dumped) using PyStasm on Ubuntu 14.04(VirtualBox) #2

Open mrgloom opened 8 years ago

mrgloom commented 8 years ago

I get Segmentation fault (core dumped) using PyStasm. It happends sometimes on image 98, and sometimes after all images processed.

http://stackoverflow.com/questions/13654449/error-segmentation-fault-core-dumped

Here is my code: https://github.com/mrgloom/Kaggle-Facial-Keypoints-Detection-Solutions/blob/master/stasm_example.py

pip freeze

Cython==0.23.3
PAM==0.4.2
Pillow==3.0.0
PyStasm==0.3.1
PyYAML==3.11
Twisted-Core==13.2.0
Twisted-Web==13.2.0
adium-theme-ubuntu==0.3.4
apt-xapian-index==0.45
argparse==1.2.1
chardet==2.0.1
colorama==0.2.5
command-not-found==0.3
debtagshw==0.1
decorator==4.0.4
defer==1.0.6
dirspec==13.10
duplicity==0.6.23
funcsigs==0.4
h5py==2.5.0
html5lib==0.999
httplib2==0.8
ipython==4.0.0
ipython-genutils==0.1.0
leveldb==0.193
lockfile==0.8
lxml==3.3.3
matplotlib==1.4.3
mock==1.3.0
networkx==1.10
nose==1.3.7
numpy==1.9.3
oauthlib==0.6.1
oneconf==0.3.7.14.04.1
pandas==0.16.2
path.py==8.1.1
pbr==1.8.0
pexpect==3.1
pickleshare==0.5
piston-mini-client==0.7.5
protobuf==2.6.1
pyOpenSSL==0.13
pycrypto==2.6.1
pycups==1.9.66
pygobject==3.12.0
pyparsing==2.0.3
pyserial==2.6
pysmbc==1.0.14.1
python-apt==0.9.3.5ubuntu1
python-dateutil==2.4.2
python-debian==0.1.21-nmu2ubuntu2
python-gflags==2.0
pytz==2015.6
pyxdg==0.25
reportlab==3.0
requests==2.2.1
scikit-image==0.11.3
scikit-learn==0.17
scipy==0.16.0
sessioninstaller==0.0.0
simplegeneric==0.8.1
six==1.9.0
sklearn==0.0
software-center-aptd-plugins==0.0.0
system-service==0.1.6
traitlets==4.0.0
unity-lens-photos==1.0
urllib3==1.7.1
wheel==0.24.0
wsgiref==0.1.2
xdiagnose==3.6.3build2
zope.interface==4.0.5

Another question is how to use stasm.search_pinned when I have croped face and don't need face detection? in what format pinned input should be?

mjszczep commented 8 years ago

Sorry to hear you're having so many issues with the library; thanks for bearing with me as I examine them. Would you mind sending me the image(s) that cause the segfault?

In response to your second question, pinned should be a list of points in the same format as the landmarks returned by search_single or similar.

mrgloom commented 8 years ago

I think problem not in specific images, but in the fact that function called many times (maybe some memory issues?)

However I tried this test and it's works:

import os.path
import cv2
import stasm

path = os.path.join(stasm.DATADIR, 'testface.jpg')

for i in range(0, 1000):
    print i
    img = cv2.imread(path, cv2.IMREAD_GRAYSCALE)
    if img is None:
        print("Cannot load", path)
        raise SystemExit

    landmarks = stasm.search_single(img)

    if len(landmarks) == 0:
        print("No face found in", path)
    else:
        landmarks = stasm.force_points_into_image(landmarks, img)
        for point in landmarks:
            img[round(point[1])][round(point[0])] = 255

    #cv2.imshow("stasm minimal", img)
    #cv2.waitKey(0)

here is the data which I used with my script https://drive.google.com/file/d/0B88eZEyituf8OUYwNzNNajI1TUk/view?usp=sharing