Cloud Vision APIでフェルメール「真珠の耳飾りの少女」の所蔵美術館を調べる

#真珠の耳飾りの少女
![](http://www.art-library.com/vermeer/img/vmr101.jpg)
こちらはフェルメールの作品「真珠の耳飾りの少女」(青いターバンの少女)。これをCloud Vision APIに認識させて結果を見てみます。

#Cloud Vision APIの使い方
多くの解説記事が出ているので、ここでは省略します。
[Vision API - 機械学習による画像分析 — Google Cloud Platform](https://cloud.google.com/vision/)

#LANDMARK_DETECTION
LANDMARK_DETECTIONを使って所蔵美術館を調べます。認識結果は以下のとおり。見事にピンポイントで所蔵美術館であるマウリッツハイス美術館を提示しました。

- マウリッツハイス美術館(Mauritshuis)
	- score:0.94657236
- Nieuwe Kerk(新教会)
	- アムステルダムの教会
	- score:0.785544
- アムステルダム国立美術館(Rijksmuseum Amsterdam)
	- score:0.4209882

```json
{
    "responses": [
        {
            "landmarkAnnotations": [
                {
                    "boundingPoly": {
                        "vertices": [
                            {
                                "x": 95, 
                                "y": 72
                            }, 
                            {
                                "x": 410, 
                                "y": 72
                            }, 
                            {
                                "x": 410, 
                                "y": 570
                            }, 
                            {
                                "x": 95, 
                                "y": 570
                            }
                        ]
                    }, 
                    "description": "Mauritshuis", 
                    "locations": [
                        {
                            "latLng": {
                                "latitude": 52.080212, 
                                "longitude": 4.314511
                            }
                        }
                    ], 
                    "mid": "/m/0dqzc", 
                    "score": 0.94657236
                }, 
                {
                    "boundingPoly": {
                        "vertices": [
                            {
                                "x": 95, 
                                "y": 98
                            }, 
                            {
                                "x": 399, 
                                "y": 98
                            }, 
                            {
                                "x": 399, 
                                "y": 541
                            }, 
                            {
                                "x": 95, 
                                "y": 541
                            }
                        ]
                    }, 
                    "description": "Nieuwe Kerk", 
                    "locations": [
                        {
                            "latLng": {
                                "latitude": 52.011843999999996, 
                                "longitude": 4.35943
                            }
                        }
                    ], 
                    "mid": "/m/07t441", 
                    "score": 0.785544
                }, 
                {
                    "boundingPoly": {
                        "vertices": [
                            {
                                "x": 178, 
                                "y": 106
                            }, 
                            {
                                "x": 318, 
                                "y": 106
                            }, 
                            {
                                "x": 318, 
                                "y": 444
                            }, 
                            {
                                "x": 178, 
                                "y": 444
                            }
                        ]
                    }, 
                    "description": "Rijksmuseum Amsterdam", 
                    "locations": [
                        {
                            "latLng": {
                                "latitude": 52.359038, 
                                "longitude": 4.883803725242615
                            }
                        }
                    ], 
                    "mid": "/m/06jsf", 
                    "score": 0.4209882
                }
            ]
        }
    ]
}

```

#LOGO_DETECTION
LOGO_DETECTIONをやってみます。結果は以下のとおり。作品名を返してくれましたw すごい。

- Girl with a Pearl Earring
	- "score": 0.81485242
- Johannes Vermeer Girl with a Pearl Earring Art Print Poster
	- ヨハネスフェルメール「真珠の耳飾りの少女」のポスター
- VERMEER, JOHANNES
- Girl With A Pearl Earring
- The Girl with a Pearl Earring
- Girl with a Pearl Earring, circa 1665-6
	- circa(年代)
	- 1665-6年ごろの作品であることもわかっているようです
- Girl with a Pearl Earring, c.1665-6 (oil on canvas)
	- 油画であることも教えてくれました

```json
{
    "responses": [
        {
            "logoAnnotations": [
                {
                    "boundingPoly": {
                        "vertices": [
                            {
                                "x": 80, 
                                "y": 78
                            }, 
                            {
                                "x": 404, 
                                "y": 78
                            }, 
                            {
                                "x": 404, 
                                "y": 524
                            }, 
                            {
                                "x": 80, 
                                "y": 524
                            }
                        ]
                    }, 
                    "description": "Girl with a Pearl Earring", 
                    "score": 0.81485242
                }, 
                {
                    "boundingPoly": {
                        "vertices": [
                            {
                                "x": 114, 
                                "y": 77
                            }, 
                            {
                                "x": 372, 
                                "y": 77
                            }, 
                            {
                                "x": 372, 
                                "y": 519
                            }, 
                            {
                                "x": 114, 
                                "y": 519
                            }
                        ]
                    }, 
                    "description": "Johannes Vermeer Girl with a Pearl Earring Art Print Poster", 
                    "score": 0.80715144
                }, 
                {
                    "boundingPoly": {
                        "vertices": [
                            {
                                "x": 107, 
                                "y": 77
                            }, 
                            {
                                "x": 401, 
                                "y": 77
                            }, 
                            {
                                "x": 401, 
                                "y": 508
                            }, 
                            {
                                "x": 107, 
                                "y": 508
                            }
                        ]
                    }, 
                    "description": "VERMEER, JOHANNES", 
                    "score": 0.80634362
                }, 
                {
                    "boundingPoly": {
                        "vertices": [
                            {
                                "x": 103, 
                                "y": 84
                            }, 
                            {
                                "x": 396, 
                                "y": 84
                            }, 
                            {
                                "x": 396, 
                                "y": 487
                            }, 
                            {
                                "x": 103, 
                                "y": 487
                            }
                        ]
                    }, 
                    "description": "Girl With A Pearl Earring", 
                    "score": 0.79543543
                }, 
                {
                    "boundingPoly": {
                        "vertices": [
                            {
                                "x": 103, 
                                "y": 50
                            }, 
                            {
                                "x": 396, 
                                "y": 50
                            }, 
                            {
                                "x": 396, 
                                "y": 508
                            }, 
                            {
                                "x": 103, 
                                "y": 508
                            }
                        ]
                    }, 
                    "description": "The Girl with a Pearl Earring", 
                    "score": 0.79434925
                }, 
                {
                    "boundingPoly": {
                        "vertices": [
                            {
                                "x": 96, 
                                "y": 77
                            }, 
                            {
                                "x": 393, 
                                "y": 77
                            }, 
                            {
                                "x": 393, 
                                "y": 483
                            }, 
                            {
                                "x": 96, 
                                "y": 483
                            }
                        ]
                    }, 
                    "description": "Girl with Pearl Earring", 
                    "score": 0.78315473
                }, 
                {
                    "boundingPoly": {
                        "vertices": [
                            {
                                "x": 105, 
                                "y": 157
                            }, 
                            {
                                "x": 299, 
                                "y": 157
                            }, 
                            {
                                "x": 299, 
                                "y": 364
                            }, 
                            {
                                "x": 105, 
                                "y": 364
                            }
                        ]
                    }, 
                    "description": "Girl with a Pearl Earring (detail)", 
                    "score": 0.74823368
                }, 
                {
                    "boundingPoly": {
                        "vertices": [
                            {
                                "x": 109, 
                                "y": 71
                            }, 
                            {
                                "x": 404, 
                                "y": 71
                            }, 
                            {
                                "x": 404, 
                                "y": 460
                            }, 
                            {
                                "x": 109, 
                                "y": 460
                            }
                        ]
                    }, 
                    "description": "Girl with a Pearl Earring", 
                    "score": 0.70537269
                }, 
                {
                    "boundingPoly": {
                        "vertices": [
                            {
                                "x": 109, 
                                "y": 96
                            }, 
                            {
                                "x": 346, 
                                "y": 96
                            }, 
                            {
                                "x": 346, 
                                "y": 471
                            }, 
                            {
                                "x": 109, 
                                "y": 471
                            }
                        ]
                    }, 
                    "description": "Girl with a Pearl Earring", 
                    "score": 0.59105766
                }, 
                {
                    "boundingPoly": {
                        "vertices": [
                            {
                                "x": 114, 
                                "y": 50
                            }, 
                            {
                                "x": 353, 
                                "y": 50
                            }, 
                            {
                                "x": 353, 
                                "y": 334
                            }, 
                            {
                                "x": 114, 
                                "y": 334
                            }
                        ]
                    }, 
                    "description": "Girl with a Pearl Earring, circa 1665-6", 
                    "score": 0.51366377
                }, 
                {
                    "boundingPoly": {
                        "vertices": [
                            {
                                "x": 114, 
                                "y": 101
                            }, 
                            {
                                "x": 394, 
                                "y": 101
                            }, 
                            {
                                "x": 394, 
                                "y": 508
                            }, 
                            {
                                "x": 114, 
                                "y": 508
                            }
                        ]
                    }, 
                    "description": "Girl with a Pearl Earring, c.1665-6 (oil on canvas)", 
                    "score": 0.4522222
                }, 
                {
                    "boundingPoly": {
                        "vertices": [
                            {
                                "x": 80, 
                                "y": 71
                            }, 
                            {
                                "x": 332, 
                                "y": 71
                            }, 
                            {
                                "x": 332, 
                                "y": 401
                            }, 
                            {
                                "x": 80, 
                                "y": 401
                            }
                        ]
                    }, 
                    "description": "Girl with Pearl Earring", 
                    "score": 0.4480527
                }, 
                {
                    "boundingPoly": {
                        "vertices": [
                            {
                                "x": 114, 
                                "y": 101
                            }, 
                            {
                                "x": 394, 
                                "y": 101
                            }, 
                            {
                                "x": 394, 
                                "y": 508
                            }, 
                            {
                                "x": 114, 
                                "y": 508
                            }
                        ]
                    }, 
                    "description": "Girl with a Pearl Earring, c.1665-6 (oil on canvas)", 
                    "score": 0.43572882
                }, 
                {
                    "boundingPoly": {
                        "vertices": [
                            {
                                "x": 114, 
                                "y": 101
                            }, 
                            {
                                "x": 353, 
                                "y": 101
                            }, 
                            {
                                "x": 353, 
                                "y": 344
                            }, 
                            {
                                "x": 114, 
                                "y": 344
                            }
                        ]
                    }, 
                    "description": "Girl with a Pearl Earring, circa 1665-6", 
                    "score": 0.41037294
                }, 
                {
                    "boundingPoly": {
                        "vertices": [
                            {
                                "x": 114, 
                                "y": 101
                            }, 
                            {
                                "x": 401, 
                                "y": 101
                            }, 
                            {
                                "x": 401, 
                                "y": 415
                            }, 
                            {
                                "x": 114, 
                                "y": 415
                            }
                        ]
                    }, 
                    "description": "Girl with a Pearl Earring", 
                    "score": 0.39971495
                }
            ]
        }
    ]
}
```

#LABEL_DETECTION
画像のラベル認識をさせてみます。てっきりこれで作品名がわかるのかと思いましたが、大雑把なラベリングを返してくれました。「絵画」のようなラベルをつけていました。

```json
{"responses":[{"labelAnnotations":[{"mid":"/m/05qdh","description":"painting","score":0.95385218},{"mid":"/m/068jd","description":"photograph","score":0.90178573},{"mid":"/m/01dv4h","description":"portrait","score":0.88216966},{"mid":"/m/05wkw","description":"photography","score":0.88041991},{"mid":"/m/0fc1fy","description":"black hair","score":0.79505515},{"mid":"/m/02pkb8","description":"lady","score":0.64335483},{"mid":"/m/01443y","description":"headgear","score":0.5553062}]}]}
```


#考察
- LANDMARK_DETECTIONは著名な名所だけでなく絵画も認識
	- 物理的に移動できても美術館のような位置と関連付けたものは位置を算出できる
- LOGO_DETECTIONは企業のロゴだけでなく、絵画のような作品も認識
	- 美術作品の名前がわからないときに調べることができる
	- 美術館に行った時にCloud Vision APIを使ったカメラアプリがあったら使う人もいるかもしれない
- LABEL_DETECTIONは大雑把なラベリング
	- 大量の画像をグループに分ける時に使えそう