Flame442 / FlameCogs

Cogs made by Flame for Red, a discord bot https://github.com/Cog-Creators/Red-DiscordBot

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Face] Revive face cog with Face++ API

owocado opened this issue · comments

Describe the feature
So I recently came across this new face detection API called Face++.
I played around for a bit and I noticed the fuctionality is quite similar to the Azure face detection API which you have implemented in current face cog (it's unsupported currently, I know).
It has few different APIs for facial recognition but the one which caught my eye was it's Detect API <-- link to docs.

You only need to signup and register for a free API key which gives you api_key and api_secret to try with.
So it will be relatively easier to setup for end user compared with the current requirement for face cog to do setup on Azure.
The API supports JPG. JPEG and PNG formats. Maximum file size it supports is no larger than 2MB though so this could be considered a disadvantage to some degree. It supports upto 4096px * 4096px in dimensions.

If you want to test this out, you can make a sample request once you have registered for API key:

curl -X POST "https://api-us.faceplusplus.com/facepp/v3/detect" -F "api_key=<api_key>" \
-F "api_secret=<api_secret>" \
-F "image_file=@unknown.png" \
-F "return_attributes=gender,age,emotion,ethnicity"

which returns a sample JSON response:

{
  "request_id": "1598188488,ffba4fb4-ea9f-4997-a0b0-46fc6949dfa8",
  "time_used": 241,
  "faces": [
    {
      "face_token": "5fae998233aceecdd3a0918a3e746d0b",
      "face_rectangle": {
        "top": 282,
        "left": 216,
        "width": 201,
        "height": 201
      },
      "attributes": {
        "gender": {
          "value": "Male"
        },
        "age": {
          "value": 25
        },
        "emotion": {
          "anger": 0.092,
          "disgust": 22.036,
          "fear": 1.204,
          "happiness": 5.66,
          "neutral": 1.252,
          "sadness": 69.664,
          "surprise": 0.092
        },
        "ethnicity": {
          "value": ""
        }
      }
    }
  ],
  "image_id": "T9r4QsXJbZq8qCPCL7U+uA==",
  "face_num": 1
}

You can add or remove more attributes if you want, or make it customizable to user input.
Current valid attributes are:

gender, age, smiling, headpose, facequality, blur, eyestatus, emotion, ethnicity, beauty, mouthstatus, eyegaze, skinstatus

I think this would be really fun and helpful to alot of people, if revived. Feel free to reject it though, if you don't like it.
Please let me know what do you think.

Description of what you would like added

Basically what I said above.