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

Error while use batch_face_locations and how to get pixel of face location #909

Open
blinkbink opened this issue Aug 21, 2019 · 0 comments

Comments

@blinkbink
Copy link

blinkbink commented Aug 21, 2019

  • face_recognition version: 1.2.3
  • Python version: 3.6.8
  • Operating System: ubuntu 18.04

i'm try to use batch_face_locations, this my code :

selfieimage = face_recognition.load_image_file("path")
face_locations2 =face_recognition.batch_face_locations(selfieimage,number_of_times_to_upsample=0,batch_size=128)
       

but got this error :

_call__(): incompatible function arguments. The following argument types are supported:
    1. (self: dlib.cnn_face_detection_model_v1, imgs: list, upsample_num_times: int=0, batch_size: int=128) -> std::vector<std::vector<dlib::mmod_rect, std::allocator<dlib::mmod_rect> >, std::allocator<std::vector<dlib::mmod_rect, std::allocator<dlib::mmod_rect> > > >
    2. (self: dlib.cnn_face_detection_model_v1, img: array, upsample_num_times: int=0) -> std::vector<dlib::mmod_rect, std::allocator<dlib::mmod_rect> >

Invoked with: <dlib.cnn_face_detection_model_v1 object at 0x7f4c901706f8>, array([[[255, 255, 218],
        [255, 255, 218],
        [255, 255, 218],
        ...,
        [255, 255, 255],
        [255, 255, 255],
        [255, 255, 255]],

       [[255, 255, 218],
        [255, 255, 218],
        [255, 255, 218],
        ...,
        [255, 255, 255],
        [255, 255, 255],
        [255, 255, 255]],

       [[255, 255, 218],
        [255, 255, 218],
        [255, 255, 218],
        ...,
        [255, 255, 255],
        [255, 255, 255],
        [255, 255, 255]],

       ...,

       [[230, 148, 120],
        [230, 148, 120],
        [230, 148, 120],
        ...,
        [255, 191, 195],
        [255, 191, 195],
        [255, 191, 195]],

       [[230, 148, 120],
        [230, 148, 120],
        [230, 148, 120],
        ...,
        [255, 191, 195],
        [255, 191, 195],
        [255, 191, 195]],

       [[230, 148, 120],
        [230, 148, 120],
        [230, 148, 120],
        ...,
        [255, 191, 195],
        [255, 191, 195],
        [255, 191, 195]]], dtype=uint8), 1; kwargs: batch_size=128

Did you forget to `#include <pybind11/stl.h>`? Or <pybind11/complex.h>,
<pybind11/functional.h>, <pybind11/chrono.h>, etc. Some automatic
conversions are optional and require extra headers to be included
when compiling your pybind11 module

why this happen ?

and how to find pixel of face cause i want to compare higher pixel if more than one face is detected in photo, what i try is calculate the top, right, bottom, left but is wrong:

face_locations1 = face_recognition.face_locations(selfieimage, number_of_times_to_upsample=2, model="cnn")
compare_encode1 = face_recognition.face_encodings(selfieimage, face_locations1, num_jitters=6)

            for (top, right, bottom, left), face_encoding in zip(face_locations1, compare_encode1):
                i = 0
              print(face_encoding)
                res = [compare_encode1[i]]
                selfielowest.append(compare_encode1[i])
                i = i + 1
@blinkbink blinkbink changed the title Error while use batch_face_locations Error while use batch_face_locations and how to get pixel of face location Aug 21, 2019
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

1 participant