Jonkman Microblog
  • Login
Show Navigation
  • Public

    • Public
    • Network
    • Groups
    • Popular
    • People

Conversation

Notices

  1. Brian Ó (blacksam@social.gibberfish.org)'s status on Friday, 08-Mar-2019 10:24:37 EST Brian Ó Brian Ó

    Fuuuck... that python face_recognition library was able to match the image on the left to the image on the right 😲

    Try it yourself (where /tmp/foo.jpg is a picture with a face):
    ```
    #!/usr/bin/env python3
    import face_recognition, io, re, requests

    searx_server = 'search.gibberfish.org'
    search_term = 'bernie'
    url = f'https://{searx_server}/?q={search_term}&categories=images&language=en-US&format=json'
    hits =[]
    misses = []
    with open('/tmp/foo.jpg', 'rb') as sourcefile:
    original = face_recognition.load_image_file(io.BytesIO(sourcefile.read()))
    original_encoding = face_recognition.face_encodings(original)[0]
    r = requests.get(url)
    results = r.json()
    count = 0
    for item in results['results']:
    img_url = item['img_src']
    if re.match(r'https?://', img_url):
    try:
    r = requests.get(img_url, stream=True, timeout=3.0)
    if r.status_code == requests.codes.ok:
    r.raw.decode_content = True
    unknown = face_recognition.load_image_file(io.BytesIO(r.raw.read()))
    unknown_encoding = face_recognition.face_encodings(unknown)[0]
    results = face_recognition.compare_faces([original_encoding], unknown_encoding)
    if results[0]:
    hits.append(img_url)
    else:
    misses.append(img_url)
    count = count + 1
    print(count)
    if count > 25:
    break
    except:
    pass
    print("Hits:")
    [print(h) for h in hits]
    print("Misses")
    [print(m) for m in misses]
    ```

    #python #face_recognition #facialrecognition #bernie

    In conversation Friday, 08-Mar-2019 10:24:37 EST from social.gibberfish.org permalink
  • Help
  • About
  • FAQ
  • TOS
  • Privacy
  • Source
  • Version
  • Contact

Jonkman Microblog is a social network, courtesy of SOBAC Microcomputer Services. It runs on GNU social, version 1.2.0-beta5, available under the GNU Affero General Public License.

Creative Commons Attribution 3.0 All Jonkman Microblog content and data are available under the Creative Commons Attribution 3.0 license.

Switch to desktop site layout.