Skip to content

Instantly share code, notes, and snippets.

@seanbenhur
Created May 17, 2021 14:20
Show Gist options
  • Save seanbenhur/ce8d19f6dd6a31f2d90b9f304fd4b88d to your computer and use it in GitHub Desktop.
Save seanbenhur/ce8d19f6dd6a31f2d90b9f304fd4b88d to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"name": "Two face Comapre(Simple)",
"provenance": []
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
},
"accelerator": "GPU"
},
"cells": [
{
"cell_type": "code",
"metadata": {
"id": "BI-TpiRItSRJ",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 309
},
"outputId": "93489983-18c9-464b-d25f-55f47217ad2e"
},
"source": [
"!pip install face_recognition"
],
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"text": [
"Collecting face_recognition\n",
" Downloading https://files.pythonhosted.org/packages/1e/95/f6c9330f54ab07bfa032bf3715c12455a381083125d8880c43cbe76bb3d0/face_recognition-1.3.0-py2.py3-none-any.whl\n",
"Requirement already satisfied: Click>=6.0 in /usr/local/lib/python3.6/dist-packages (from face_recognition) (7.1.1)\n",
"Requirement already satisfied: dlib>=19.7 in /usr/local/lib/python3.6/dist-packages (from face_recognition) (19.18.0)\n",
"Collecting face-recognition-models>=0.3.0\n",
"\u001b[?25l Downloading https://files.pythonhosted.org/packages/cf/3b/4fd8c534f6c0d1b80ce0973d01331525538045084c73c153ee6df20224cf/face_recognition_models-0.3.0.tar.gz (100.1MB)\n",
"\u001b[K |████████████████████████████████| 100.2MB 31kB/s \n",
"\u001b[?25hRequirement already satisfied: Pillow in /usr/local/lib/python3.6/dist-packages (from face_recognition) (7.0.0)\n",
"Requirement already satisfied: numpy in /usr/local/lib/python3.6/dist-packages (from face_recognition) (1.18.3)\n",
"Building wheels for collected packages: face-recognition-models\n",
" Building wheel for face-recognition-models (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
" Created wheel for face-recognition-models: filename=face_recognition_models-0.3.0-py2.py3-none-any.whl size=100566172 sha256=fc725c26f897d20041f124bfe6647c53f6103decdb3cdd11758e9c6d5bb0b4d7\n",
" Stored in directory: /root/.cache/pip/wheels/d2/99/18/59c6c8f01e39810415c0e63f5bede7d83dfb0ffc039865465f\n",
"Successfully built face-recognition-models\n",
"Installing collected packages: face-recognition-models, face-recognition\n",
"Successfully installed face-recognition-1.3.0 face-recognition-models-0.3.0\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "code",
"metadata": {
"id": "V4Xfb0RnwxSD"
},
"source": [
"import face_recognition\n",
"known_image = face_recognition.load_image_file('harry.jpg')\n",
"unknown_image = face_recognition.load_image_file('bean.jpg')\n",
"\n",
"biden_encoding = face_recognition.face_encodings(known_image)[0]\n",
"unknown_encoding = face_recognition.face_encodings(unknown_image)[0]\n",
"\n",
"results = face_recognition.compare_faces([biden_encoding], unknown_encoding)"
],
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"id": "jPZnbiYPz_yT",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 34
},
"outputId": "72805663-d1de-40dc-f2ef-3385fa79f52f"
},
"source": [
"print(results)"
],
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"text": [
"[False]\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "code",
"metadata": {
"id": "K9CdXZmy0LB9"
},
"source": [
""
],
"execution_count": null,
"outputs": []
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment