DeepStackのObject Detectionを試す
2021/07/17
DeepStackのObject Detectionを試したメモ
画像内のオブジェクトを見つける物体検出API
現時点では80種類のオブジェクトが判断できるみたい
person, bicycle, car, motorcycle, airplane, bus, train, truck, boat, traffic light,
fire hydrant, stop_sign, parking meter, bench, bird, cat, dog, horse, sheep, cow,
elephant, bear, zebra, giraffe, backpack, umbrella, handbag, tie, suitcase, frisbee,
skis, snowboard, sports ball, kite, baseball bat, baseball glove, skateboard,
surfboard, tennis racket, bottle, wine glass, cup, fork, knife, spoon, bowl, banana,
apple, sandwich, orange, broccoli, carrot, hot dog, pizza, donot, cake, chair, couch,
potted plant, bed, dining table, toilet, tv, laptop, mouse, remote, keyboard,
cell phone, microwave, oven, toaster, sink, refrigerator, book, clock, vase,
scissors, teddy bear, hair dryer, toothbrush
https://docs.deepstack.cc/object-detection/index.html#classes
手順
起動
Dockerイメージが用意されているので簡単に起動することができる
$ docker run -e VISION-DETECTION=True -v localstorage:/datastore -p 80:5000 deepquestai/deepstack
実行
Curlで画像ファイルをPOSTしたら結果が返ってくる
$ curl -X POST -F image=@{画像ファイル} http://localhost:80/v1/vision/detection
この画像はPAKUTASO様からお借りした(https://www.pakutaso.com/20170609172post-12164.html)
$ curl -s -X POST -F image=@sample.jpg http://localhost:80/v1/vision/detection |jq .
{
"success": true,
"predictions": [
{
"confidence": 0.7281746,
"label": "motorcycle",
"y_min": 275,
"x_min": 241,
"y_max": 388,
"x_max": 401
},
{
"confidence": 0.856776,
"label": "person",
"y_min": 219,
"x_min": 131,
"y_max": 418,
"x_max": 246
},
{
"confidence": 0.86147404,
"label": "bicycle",
"y_min": 294,
"x_min": 100,
"y_max": 468,
"x_max": 301
},
{
"confidence": 0.9212758,
"label": "cow",
"y_min": 293,
"x_min": 359,
"y_max": 482,
"x_max": 566
}
],
"duration": 0
}
バイク、人、自転車、牛。ちゃんと認識されていて精度良さそう!
物体の位置も返ってくる