This article participates in Teratail's Bulemix Advent Calendar.
I just entered the war because I was investigating Bluemix to have pepper serve customers.
This time, by using Visual Recognition and pepper in IBM's Bluemix, Here's how to get your LINE ID from a girl.
Now, let's show you the flow of getting the LINE ID from a girl easily.
Pepper takes a picture
↓
Analyze photos with Visual Recognition
↓
Determine if you are a girl and 18-27 years old (at your own taste)
↓ ↓
true false
↓ ↓
Pepper asks for LINE ID
It's very easy to understand.
VisualRecognition From Catalog Page
Detects the meaning contained in the image content. Analyze scenes, objects, facial images, and other content. Choose an off-the-shelf default model or create your own custom type. Detects similar images in the collection. Create smart applications to analyze the image content of images and video frames and understand what is happening.
Hmm, what is it really like?
API Reference and [Demo Page](http://visual-recognition-demo.mybluemix. You can get a general idea from net /).
It seems that you can do it like this ↓
{
"images": [
{
"faces": [
{
"age": {
"max": 54,
"min": 45,
"score": 0.372036
},
"face_location": {
"height": 75,
"left": 256,
"top": 93,
"width": 67
},
"gender": {
"gender": "MALE",
"score": 0.99593
},
"identity": {
"name": "Barack Obama",
"score": 0.989013,
"type_hierarchy": "/people/politicians/democrats/barack
obama"
}
}
],
"image": "prez.jpg "
}
],
"images_processed": 1
}
Oh!
--Maximum / minimum age --The location of the face in the image
Is coming out. It seems that object detection etc. is performed except for the human face.
Pepper seems to work with Python, so it was written by a Python beginner. Please tell me if there is something strange.
# -*- coding: utf-8 -*-
import json
from os.path import join, dirname
from os import environ
from watson_developer_cloud import VisualRecognitionV3
import os.path
#Rewrite as appropriate
api_key = ''
image_name = ''
visual_recognition = VisualRecognitionV3('2016-05-20', api_key={api_key})
jsonData = visual_recognition.detect_faces(images_file=open({image_name}))
print(json.dumps(jsonData, indent=2))
faces = jsonData['images'][0]['faces'][0]
gender = faces['gender']['gender']
age_min = faces['age']['min']
age_max = faces['age']['max']
print(gender)
print(str(age_min) + '~' + str(age_max) + 'age')
#Let pepper do it
if 18 <= age_min and age_max <= 27:
print('Tell me your LINE ID?')
else :
print('Hi, my pepper')
There is only a feeling of being forced to take it out from json ...
Try putting values in api_key and image_name.
{
"images": [
{
"image": "kanna.jpg ",
"faces": [
{
"gender": {
"gender": "FEMALE",
"score": 0.880797
},
"age": {
"max": 24,
"score": 0.502411,
"min": 18
},
"face_location": {
"width": 140,
"top": 66,
"left": 107,
"height": 160
}
}
]
}
],
"images_processed": 1
}
FEMALE
18~24-years-old
Tell me your LINE ID
Yeah, perfect. All you have to do is let pepper do it!
It gets longer & the bug in pepper hasn't been fixed (help) so in another article sorry ∨
URL:
I participated in Teratail's Advent calendar using Bluemix's Visual Recognition. Regarding image processing, I was honestly surprised that it was very easy to handle.
I was also doing a commercial called pepper x watson, so I hope it will be easy to work with. I want a LINE ID to be completed by Christmas (seriously)
Tomorrow is an entry for tokutoku393.
Recommended Posts