This article is the 20th day article of Hands Lab Advent Calendar 2019
My name is @jxxpsame and I joined the company in October of this year. I touch Unicage mystery technology every day.
I haven't output anything in a blog-like format like this since yahoo! Blog when I was in junior high school, so I'm nervous.
I used Face ++'s Detect API to score a crossdressing contest for a certain team.
――Because there was a tendency to learn python with the team I belong to, I was studying ――Because you are a fan of a certain team --I wanted to try something using the API ―― ~~ I wish I could be happy because I only need my relatives ~~
The name of the face recognition platform developed by Megvii in Beijing. Face ++'s Detect API can authenticate faces and get various attributes. This time, we will score using the attribute called Beauty Score from among those attributes.
In addition, I referred to the following article for how to use Face ++. I analyzed Pairs with python ~ Face photo ~ Introduction of Face ++ API that detects the face when you send a photo and tells you the facial deviation value
7 participants in a crossdressing contest of a certain team (Imamura Ishikawa Takahashi Yamashita Togoh Naoe Yokogawa) I used the image uploaded below. Instagram
import requests
import json
import pprint
# API
# key:Person name value:Declare the URL of the image as a dictionary
url_dict = {'Person name:Image URL'}
#Number loop of target people
for img_data in url_dict.items():
response = requests.post(
'https://api-us.faceplusplus.com/facepp/v3/detect',
{
'api_key': "[Face++API Key obtained from]",
'api_secret': "[Face++API Seacret obtained from]",
'image_url': img_data[1], #Image URL
'return_attributes': 'beauty' #Attributes you want to get
}
)
#json plastic surgery
json_dict = json.loads(response.text)
print(img_data[0]) #Person name output
pprint.pprint(json_dict['faces'][0]['attributes']['beauty'])
Please refer to the link of the Instagram post page for each player's name.
Imamura
{'female_score': 77.524, 'male_score': 78.338}
Ishikawa
{'female_score': 88.169, 'male_score': 84.546}
Takahashi
{'female_score': 79.26, 'male_score': 76.487}
Yamashita
{'female_score': 76.926, 'male_score': 78.077}
Togoh
{'female_score': 82.532, 'male_score': 81.738}
Naoe
{'female_score': 78.401, 'male_score': 79.444}
Yokogawa
{'female_score': 71.818, 'male_score': 69.508}
This time, we will hire the femele_score
because it is a transvestite contest.
** The winner was Ishikawa! ** **
Compared with the actual ranking, it is as follows.
Actual ranking | Face++Ranking given in | |
---|---|---|
Ishikawa | First place | First place |
Imamura | 2nd place | 5th place |
Takahashi | 3rd place | 3rd place |
Naoe | 4th | 4th |
Yamashita | 5th place | 6th place |
Togoh | 6th place | 2nd place |
Yokokawa | 7th place | 7th place |
reference 7 giants dressed as beautiful women! 1st place Shingo Ishikawa and others makeover
Except for Togoh and Imamura, the results were almost the same as the actual ranking. Face ++ Scary.
I was reluctant to use only the face of another person for sample data, so I measured the beauty score of my own face (25 years old, male).
'beauty': {'female_score': 67.239, 'male_score': 62.417},
Cusso is low ...
Since femele_score was higher, I added gender (gender) and age (age) to the attributes to be acquired, and measured again.
{'age': {'value': 34}, 'beauty': {'female_score': 67.253, 'male_score': 62.442}, 'gender': {'value': 'Female'}}
Everyone at Hands Lab. I look forward to working with you as a 34-year-old woman.
Hands Lab Advent Calendar 2019 Day 21 is @jnuank: clap :: clap:
Recommended Posts