# Keypoint Detection

{% tabs %}
{% tab title="Python" %}
ホストされたAPIを使用してPythonで推論を実行するには、 `roboflow` Pythonパッケージを使用します:

```python
from roboflow import Roboflow
rf = Roboflow(api_key="API_KEY")
project = rf.workspace().project("MODEL_ENDPOINT")
model = project.version(VERSION).model

# ローカル画像で推論する
print(model.predict("your_image.jpg", confidence=40, overlap=30).json())

# 予測を可視化する
# model.predict("your_image.jpg", confidence=40, overlap=30).save("prediction.jpg")

# 別の場所でホストされている画像で推論する
# print(model.predict("URL_OF_YOUR_IMAGE", hosted=True, confidence=40, overlap=30).json())
```

{% endtab %}

{% tab title="cURL" %}
**Linux または MacOS**

という名前のローカルファイルのJSON予測を取得する `YOUR_IMAGE.jpg`:

```bash
base64 YOUR_IMAGE.jpg | curl -d @- \
"https://serverless.roboflow.com/your-model/42?api_key=YOUR_KEY"
```

URLを介してWeb上の別の場所でホストされている画像を推論する場合（忘れずに [URLエンコードする](https://www.urlencoder.org/)):

```bash
curl -X POST "https://serverless.roboflow.com/your-model/42?\
api_key=YOUR_KEY&\
image=https%3A%2F%2Fi.imgur.com%2FPEEvqPN.png"
```

**Windows**

次のものをインストールする必要があります [Windows用curl](https://curl.se/windows/) および [Windows用GNUのbase64ツール](http://gnuwin32.sourceforge.net/packages/coreutils.htm)。これを行う最も簡単な方法は、 [Windows用gitインストーラー](https://git-scm.com/downloads) を使用することです。これには、インストール時に「コマンドプロンプトからGitとオプションのUnixツールを使用する」を選択すると、 `curl` および `base64` コマンドラインツールも含まれます。

その後、上記と同じコマンドを使用できます。
{% endtab %}

{% tab title="Javascript" %}
**Node.js**

この例では [axios](https://github.com/axios/axios) を使用してPOSTリクエストを実行するので、最初に `npm install axios` を実行して依存関係をインストールします。

**ローカル画像で推論する**

```javascript
const axios = require("axios");
const fs = require("fs");

const image = fs.readFileSync("YOUR_IMAGE.jpg", {
    encoding: "base64"
});

axios({
    method: "POST",
    url: "https://serverless.roboflow.com/your-model/42",
    params: {
        api_key: "YOUR_KEY"
    },
    data: image,
    headers: {
        "Content-Type": "application/x-www-form-urlencoded"
    }
})
.then(function(response) {
    console.log(response.data);
})
.catch(function(error) {
    console.log(error.message);
});
```

**URL経由で別の場所でホストされている画像で推論する**

```javascript
const axios = require("axios");

axios({
    method: "POST",
    url: "https://serverless.roboflow.com/your-model/42",
    params: {
        api_key: "YOUR_KEY",
        image: "https://i.imgur.com/PEEvqPN.png"
    }
})
.then(function(response) {
    console.log(response.data);
})
.catch(function(error) {
    console.log(error.message);
});
```

**Web**

以下を通じて、リアルタイムのデバイス上推論が利用可能です `roboflow.js`。詳細は [こちらのドキュメント](/roboflow/roboflow-jp/deploy/sdks/web-browser.md).
{% endtab %}

{% tab title="Swift/iOS" %}
**Swift**

**ローカル画像で推論する**

```swift
import UIKit

// 画像を読み込み、Base64に変換する
let image = UIImage(named: "your-image-path") // アップロードする画像へのパス 例: image.jpg
let imageData = image?.jpegData(compressionQuality: 1)
let fileContent = imageData?.base64EncodedString()
let postData = fileContent!.data(using: .utf8)

// API_KEY、モデル、およびモデルバージョンを使用して推論サーバーリクエストを初期化する
var request = URLRequest(url: URL(string: "https://serverless.roboflow.com/your-model/your-model-version?api_key=YOUR_APIKEY&name=YOUR_IMAGE.jpg")!,timeoutInterval: Double.infinity)
request.addValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")
request.httpMethod = "POST"
request.httpBody = postData

// POSTリクエストを実行する
URLSession.shared.dataTask(with: request, completionHandler: { data, response, error in
    
    // レスポンスを文字列に解析する
    guard let data = data else {
        print(String(describing: error))
        return
    }
    
    // レスポンス文字列をDictionaryに変換する
    do {
        let dict = try JSONSerialization.jsonObject(with: data, options: []) as? [String: Any]
    } catch {
        print(error.localizedDescription)
    }
    
    // 文字列レスポンスを出力する
    print(String(data: data, encoding: .utf8)!)
}).resume()
```

**Objective C**

[Objective-Cのスニペットをリクエストするには、ここをクリックしてください。](https://app.roboflow.com/request/snippet.inference-objc)
{% endtab %}

{% tab title="Android" %}
**Kotlin**

**ローカル画像で推論する**

```kotlin
import java.io.*
import java.net.HttpURLConnection
import java.net.URL
import java.nio.charset.StandardCharsets
import java.util.*

fun main() {
    // 画像パスを取得する
    val filePath = System.getProperty("user.dir") + System.getProperty("file.separator") + "YOUR_IMAGE.jpg"
    val file = File(filePath)

    // Base64でエンコードする
    val encodedFile: String
    val fileInputStreamReader = FileInputStream(file)
    val bytes = ByteArray(file.length().toInt())
    fileInputStreamReader.read(bytes)
    encodedFile = String(Base64.getEncoder().encode(bytes), StandardCharsets.US_ASCII)
    val API_KEY = "" // APIキー
    val MODEL_ENDPOINT = "dataset/v" // モデルエンドポイントを設定（Dataset URL内にあります）

    // URLを構築する
    val uploadURL ="https://serverless.roboflow.com/" + MODEL_ENDPOINT + "?api_key=" + API_KEY + "&name=YOUR_IMAGE.jpg";

    // HTTPリクエスト
    var connection: HttpURLConnection? = null
    try {
        // URLへの接続を設定する
        val url = URL(uploadURL)
        connection = url.openConnection() as HttpURLConnection
        connection.requestMethod = "POST"
        connection.setRequestProperty("Content-Type",
                "application/x-www-form-urlencoded")
        connection.setRequestProperty("Content-Length",
                Integer.toString(encodedFile.toByteArray().size))
        connection.setRequestProperty("Content-Language", "en-US")
        connection.useCaches = false
        connection.doOutput = true

        // リクエストを送信する
        val wr = DataOutputStream(
                connection.outputStream)
        wr.writeBytes(encodedFile)
        wr.close()

        // レスポンスを取得する
        val stream = connection.inputStream
        val reader = BufferedReader(InputStreamReader(stream))
        var line: String?
        while (reader.readLine().also { line = it } != null) {
            println(line)
        }
        reader.close()
    } catch (e: Exception) {
        e.printStackTrace()
    } finally {
        connection?.disconnect()
    }
}
main()
```

**URL経由で別の場所でホストされている画像で推論する**

```kotlin
import java.io.BufferedReader
import java.io.DataOutputStream
import java.io.InputStreamReader
import java.net.HttpURLConnection
import java.net.URL
import java.net.URLEncoder

fun main() {
    val imageURL = "https://i.imgur.com/PEEvqPN.png" // 画像URLを置き換える
    val API_KEY = "" // APIキー
    val MODEL_ENDPOINT = "dataset/v" // モデルエンドポイントを設定

    // アップロードURL
    val uploadURL = "https://serverless.roboflow.com/" + MODEL_ENDPOINT + "?api_key=" + API_KEY + "&image=" + URLEncoder.encode(imageURL, "utf-8");

    // HTTPリクエスト
    var connection: HttpURLConnection? = null
    try {
        // URLへの接続を設定する
        val url = URL(uploadURL)
        connection = url.openConnection() as HttpURLConnection
        connection.requestMethod = "POST"
        connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded")
        connection.setRequestProperty("Content-Length", Integer.toString(uploadURL.toByteArray().size))
        connection.setRequestProperty("Content-Language", "en-US")
        connection.useCaches = false
        connection.doOutput = true

        // リクエストを送信する
        val wr = DataOutputStream(connection.outputStream)
        wr.writeBytes(uploadURL)
        wr.close()

        // レスポンスを取得する
        val stream = URL(uploadURL).openStream()
        val reader = BufferedReader(InputStreamReader(stream))
        var line: String?
        while (reader.readLine().also { line = it } != null) {
            println(line)
        }
        reader.close()
    } catch (e: Exception) {
        e.printStackTrace()
    } finally {
        connection?.disconnect()
    }
}

main()
```

**Java**

**ローカル画像で推論する**

```java
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.Base64;

public class InferenceLocal {
    public static void main(String[] args) throws IOException {
        // 画像パスを取得する
        String filePath = System.getProperty("user.dir") + System.getProperty("file.separator") + "YOUR_IMAGE.jpg";
        File file = new File(filePath);

        // Base64でエンコードする
        String encodedFile;
        FileInputStream fileInputStreamReader = new FileInputStream(file);
        byte[] bytes = new byte[(int) file.length()];
        fileInputStreamReader.read(bytes);
        encodedFile = new String(Base64.getEncoder().encode(bytes), StandardCharsets.US_ASCII);

        String API_KEY = ""; // APIキー
        String MODEL_ENDPOINT = "dataset/v"; // モデルエンドポイント

        // URLを構築する
        String uploadURL = "https://serverless.roboflow.com/" + MODEL_ENDPOINT + "?api_key=" + API_KEY
                + "&name=YOUR_IMAGE.jpg";

        // HTTPリクエスト
        HttpURLConnection connection = null;
        try {
            // URLへの接続を設定する
            URL url = new URL(uploadURL);
            connection = (HttpURLConnection) url.openConnection();
            connection.setRequestMethod("POST");
            connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");

            connection.setRequestProperty("Content-Length", Integer.toString(encodedFile.getBytes().length));
            connection.setRequestProperty("Content-Language", "en-US");
            connection.setUseCaches(false);
            connection.setDoOutput(true);

            // リクエストを送信する
            DataOutputStream wr = new DataOutputStream(connection.getOutputStream());
            wr.writeBytes(encodedFile);
            wr.close();

            // レスポンスを取得する
            InputStream stream = connection.getInputStream();
            BufferedReader reader = new BufferedReader(new InputStreamReader(stream));
            String line;
            while ((line = reader.readLine()) != null) {
                System.out.println(line);
            }
            reader.close();
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (connection != null) {
                connection.disconnect();
            }
        }

    }

}
```

**URL経由で別の場所でホストされている画像で推論する**

```java
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;

public class InferenceHosted {
    public static void main(String[] args) {
        String imageURL = "https://i.imgur.com/PEEvqPN.png"; // 画像URLを置き換える
        String API_KEY = ""; // APIキー
        String MODEL_ENDPOINT = "dataset/v"; // モデルエンドポイント

        // アップロードURL
        String uploadURL = "https://serverless.roboflow.com/" + MODEL_ENDPOINT + "?api_key=" + API_KEY + "&image="
                + URLEncoder.encode(imageURL, StandardCharsets.UTF_8);

        // HTTPリクエスト
        HttpURLConnection connection = null;
        try {
            // URLへの接続を設定する
            URL url = new URL(uploadURL);
            connection = (HttpURLConnection) url.openConnection();
            connection.setRequestMethod("POST");
            connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");

            connection.setRequestProperty("Content-Length", Integer.toString(uploadURL.getBytes().length));
            connection.setRequestProperty("Content-Language", "en-US");
            connection.setUseCaches(false);
            connection.setDoOutput(true);

            // リクエストを送信する
            DataOutputStream wr = new DataOutputStream(connection.getOutputStream());
            wr.writeBytes(uploadURL);
            wr.close();

            // レスポンスを取得する
            InputStream stream = new URL(uploadURL).openStream();
            BufferedReader reader = new BufferedReader(new InputStreamReader(stream));
            String line;
            while ((line = reader.readLine()) != null) {
                System.out.println(line);
            }
            reader.close();
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (connection != null) {
                connection.disconnect();
            }
        }
    }
}
```

{% endtab %}

{% tab title="Ruby" %}
**Gemfile**

{% code title="Gemfile" %}

```ruby
source "https://rubygems.org"

gem "httparty", "~> 0.18.1"
gem "base64", "~> 0.1.0"
gem "cgi", "~> 0.2.1"
```

{% endcode %}

**Gemfile.lock**

{% code title="Gemfile.lock" %}

```ruby
GEM
  remote: https://rubygems.org/
  specs:
    base64 (0.1.0)
    cgi (0.2.1)
    httparty (0.18.1)
      mime-types (~> 3.0)
      multi_xml (>= 0.5.2)
    mime-types (3.3.1)
      mime-types-data (~> 3.2015)
    mime-types-data (3.2021.0225)
    multi_xml (0.6.0)

PLATFORMS
  x64-mingw32
  x86_64-linux

DEPENDENCIES
  base64 (~> 0.1.0)
  cgi (~> 0.2.1)
  httparty (~> 0.18.1)

BUNDLED WITH
   2.2.15
```

{% endcode %}

**ローカル画像で推論する**

```ruby
require 'base64'
require 'httparty'

encoded = Base64.encode64(File.open("YOUR_IMAGE.jpg", "rb").read)
model_endpoint = "dataset/v" # モデルエンドポイントを設定
api_key = "" # ここにAPIキー

params = "?api_key=" + api_key
+ "&name=YOUR_IMAGE.jpg"

response = HTTParty.post(
    "https://serverless.roboflow.com/" + model_endpoint + params,
    body: encoded, 
    headers: {
    'Content-Type' => 'application/x-www-form-urlencoded',
    'charset' => 'utf-8'
  })

  puts response

 
```

**URL経由で別の場所でホストされている画像で推論する**

```ruby
require 'httparty'
require 'cgi'

model_endpoint = "dataset/v" # モデルエンドポイントを設定
api_key = "" # ここにAPIキー
img_url = "https://i.imgur.com/PEEvqPN.png" # URLを構築する

img_url = CGI::escape(img_url)

params =  "?api_key=" + api_key + "&image=" + img_url

response = HTTParty.post(
    "https://serverless.roboflow.com/" + model_endpoint + params,
    headers: {
    'Content-Type' => 'application/x-www-form-urlencoded',
    'charset' => 'utf-8'
  })

puts response
```

{% endtab %}

{% tab title="PHP" %}
**ローカル画像で推論する**

```php
<?php

// 画像をBase64でエンコードする
$data = base64_encode(file_get_contents("YOUR_IMAGE.jpg"));

$api_key = ""; // APIキーを設定する
$model_endpoint = "dataset/v"; // モデルエンドポイントを設定する（Dataset URL内にあります）

// HTTPリクエスト用URL
$url = "https://serverless.roboflow.com/" . $model_endpoint
. "?api_key=" . $api_key
. "&name=YOUR_IMAGE.jpg";

// HTTPリクエストを設定して送信する
$options = array(
  'http' => array (
    'header' => "Content-type: application/x-www-form-urlencoded\r\n",
    'method'  => 'POST',
    'content' => $data
  ));

$context  = stream_context_create($options);
$result = file_get_contents($url, false, $context);
echo $result;
?>
```

**URL経由で別の場所でホストされている画像で推論する**

```php
<?php

$api_key = ""; // APIキーを設定する
$model_endpoint = "dataset/v"; // モデルエンドポイントを設定する（Dataset URL内にあります）
$img_url = "https://i.imgur.com/PEEvqPN.png";

// HTTPリクエスト用URL
$url =  "https://serverless.roboflow.com/" . $model_endpoint
. "?api_key=" . $api_key
. "&image=" . urlencode($img_url);

// HTTPリクエストを設定して送信する
$options = array(
  'http' => array (
    'header' => "Content-type: application/x-www-form-urlencoded\r\n",
    'method'  => 'POST'
  ));

$context  = stream_context_create($options);
$result = file_get_contents($url, false, $context);
echo $result;
?>
```

{% endtab %}

{% tab title="Go" %}
**ローカル画像で推論する**

```go
package main

import (
    "bufio"
    "encoding/base64"
    "fmt"
    "io/ioutil"
    "os"
	"net/http"
	"strings"
)

func main() {
	api_key := ""  // APIキー
	model_endpoint := "dataset/v" // モデルエンドポイントを設定

    // ディスク上のファイルを開く。
    f, _ := os.Open("YOUR_IMAGE.jpg")

    // JPG全体をバイトスライスに読み込む。
    reader := bufio.NewReader(f)
    content, _ := ioutil.ReadAll(reader)

    // base64としてエンコードする。
    data := base64.StdEncoding.EncodeToString(content)
	uploadURL := "https://serverless.roboflow.com/" + model_endpoint + "?api_key=" + api_key + "&name=YOUR_IMAGE.jpg"

	req, _ := http.NewRequest("POST", uploadURL, strings.NewReader(data))
    req.Header.Set("Accept", "application/json")

    client := &http.Client{}
    resp, _ := client.Do(req)
    defer resp.Body.Close()

   	bytes, _ := ioutil.ReadAll(resp.Body)
    fmt.Println(string(bytes))

}
```

**URL経由で別の場所でホストされている画像で推論する**

```go
package main

import (
    "fmt"
	"net/http"
	"net/url"
  "io/ioutil"
)

func main() {
	api_key := ""  // APIキー
	model_endpoint := "dataset/v" // モデルエンドポイントを設定
	img_url := "https://i.ibb.co/jzr27x0/YOUR-IMAGE.jpg"


	uploadURL := "https://serverless.roboflow.com/" + model_endpoint + "?api_key=" + api_key + "&image=" + url.QueryEscape(img_url)

	req, _ := http.NewRequest("POST", uploadURL, nil)
    req.Header.Set("Accept", "application/json")

    client := &http.Client{}
    resp, _ := client.Do(req)
    defer resp.Body.Close()

   	bytes, _ := ioutil.ReadAll(resp.Body)
    fmt.Println(string(bytes))


}
```

{% endtab %}

{% tab title=".NET" %}
**ローカル画像で推論する**

```csharp
using System;
using System.IO;
using System.Net;
using System.Text;

namespace InferenceLocal
{
    class InferenceLocal
    {

        static void Main(string[] args)
        {
            byte[] imageArray = System.IO.File.ReadAllBytes(@"YOUR_IMAGE.jpg");
            string encoded = Convert.ToBase64String(imageArray);
            byte[] data = Encoding.ASCII.GetBytes(encoded);
            string API_KEY = ""; // APIキー
            string MODEL_ENDPOINT = "dataset/v"; // モデルエンドポイントを設定

            // URLを構築する
            string uploadURL =
                    "https://serverless.roboflow.com/" + MODEL_ENDPOINT + "?api_key=" + API_KEY
                + "&name=YOUR_IMAGE.jpg";

            // サービスリクエスト設定
            ServicePointManager.Expect100Continue = true;
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

            // リクエストを設定する
            WebRequest request = WebRequest.Create(uploadURL);
            request.Method = "POST";
            request.ContentType = "application/x-www-form-urlencoded";
            request.ContentLength = data.Length;

            // データを書き込む
            using (Stream stream = request.GetRequestStream())
            {
                stream.Write(data, 0, data.Length);
            }

            // レスポンスを取得する
            string responseContent = null;
            using (WebResponse response = request.GetResponse())
            {
                using (Stream stream = response.GetResponseStream())
                {
                    using (StreamReader sr99 = new StreamReader(stream))
                    {
                        responseContent = sr99.ReadToEnd();
                    }
                }
            }

            Console.WriteLine(responseContent);

        }
    }
}
```

**URL経由で別の場所でホストされている画像で推論する**

```csharp
using System;
using System.IO;
using System.Net;
using System.Web;

namespace InferenceHosted
{
    class InferenceHosted
    {
        static void Main(string[] args)
        {
            string API_KEY = ""; // APIキー
            string imageURL = "https://i.ibb.co/jzr27x0/YOUR-IMAGE.jpg";
            string MODEL_ENDPOINT = "dataset/v"; // モデルエンドポイントを設定

            // URLを構築する
            string uploadURL =
                    "https://serverless.roboflow.com/" + MODEL_ENDPOINT
                    + "?api_key=" + API_KEY
                    + "&image=" + HttpUtility.UrlEncode(imageURL);

            // サービスポイント設定
            ServicePointManager.Expect100Continue = true;
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

            // HTTPリクエストを設定する
            WebRequest request = WebRequest.Create(uploadURL);
            request.Method = "POST";
            request.ContentType = "application/x-www-form-urlencoded";
            request.ContentLength = 0;

            // レスポンスを取得する
            string responseContent = null;
            using (WebResponse response = request.GetResponse())
            {
                using (Stream stream = response.GetResponseStream())
                {
                    using (StreamReader sr99 = new StreamReader(stream))
                    {
                        responseContent = sr99.ReadToEnd();
                    }
                }
            }

            Console.WriteLine(responseContent);

        }
    }
}
```

{% endtab %}

{% tab title="Elixir" %}
ユーザーからのリクエストに応じてコードスニペットを追加しています。Elixirアプリに推論APIを統合したい場合は、 [ここをクリックして賛成票を記録してください](https://app.roboflow.com/request/snippet.upload-elixir).
{% endtab %}
{% endtabs %}

### レスポンスオブジェクト形式

ホストされたAPIの推論ルートは `JSON` 予測の配列を含むオブジェクトを返します。各予測には次のプロパティがあります:

* `x` = 検出されたオブジェクトの水平中心点
* `y` = 検出されたオブジェクトの垂直中心点
* `width` = バウンディングボックスの幅
* `height` = バウンディングボックスの高さ
* `class` = 検出されたオブジェクトのクラスラベル
* `confidence` = 検出されたオブジェクトに正しいラベルと位置座標があるというモデルの信頼度
* `keypoints` = キーポイント予測の配列
  * `x` = キーポイントの水平中心（画像の左上隅を基準）
  * `y` = キーポイントの垂直中心（画像の左上隅を基準）
  * `class_name` = キーポイントの名前
  * `class_id` = キーポイントのID。スケルトンにマッピングされます `vertices` バージョンレコード内で、頂点の色とスケルトンのエッジをマッピングするために、 [Project Versionを表示する](/developer/rest-api/versions/view-a-version.md)
  * `confidence` = キーポイントが正しい位置にあり、表示されている（隠れていない、または削除されていない）という信頼度

REST APIからのレスポンスオブジェクトの例を以下に示します:

```json
{
    "predictions": [
        {
            "x": 189.5,
            "y": 100,
            "width": 163,
            "height": 186,
            "class": "helmet",
            "confidence": 0.544,
            "keypoints": [
                {
                    "x": 189, 
                    "y": 20,
                    "class_name": "top",
                    "class_id": 0,
                    "confidence": 0.91
                },
                {
                    "x": 188, 
                    "y": 180,
                    "class_name": "bottom",
                    "class_id": 1,
                    "confidence": 0.93
                }
            ]
        }
    ],
    "image": {
        "width": 2048,
        "height": 1371
    }
}
```

この `image` 属性には、推論に送信された画像の高さと幅が含まれます。バウンディングボックスの計算には、これらの値を使用する必要がある場合があります。

### Inference API パラメータ

## Inference API の使用

<mark style="color:green;">`POST`</mark> `https://serverless.roboflow.com/:datasetSlug/:versionNumber`

base64 エンコードされた画像をモデルのエンドポイントに直接 POST できます。あるいは、画像が別の場所で既にホストされている場合は、クエリ文字列内の `image` パラメータとして URL を渡すこともできます。

#### パスパラメータ

| 名前          | 型      | 説明                                                                                                                                                |
| ----------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------- |
| datasetSlug | string | データセット名の URL 安全版です。トレーニング後にモデルを作成したデータセットバージョンの train results セクションで「Get curl command」ボタンをクリックするか、メインのプロジェクト画面の URL を確認することで、Web UI で見つけることができます。 |
| version     | number | データセットのバージョンを識別するバージョン番号                                                                                                                          |

#### クエリパラメータ

| 名前         | 型       | 説明                                                                                                                                                                                                                                                                       |
| ---------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| image      | string  | <p>追加する画像の URL。画像が別の場所でホストされている場合に使用します。（リクエスト本文で base64 エンコードされた画像を POST しない場合は必須です。）<br><br><strong>注意:</strong> URL エンコードするのを忘れないでください。</p>                                                                                                                           |
| classes    | string  | <p>予測を特定のクラスのみに制限します。カンマ区切りの文字列として指定してください。<br><br><strong>例:</strong> dog,cat<br><br><strong>デフォルト:</strong> 指定なし（すべてのクラスを表示）</p>                                                                                                                                       |
| overlap    | number  | <p>同じクラスのバウンディングボックス予測が 1 つのボックスに統合される前に、どの程度まで重なってよいかを示す最大割合（0〜100 の尺度）。<br><br><strong>デフォルト:</strong> 30</p>                                                                                                                                                          |
| confidence | number  | <p>返される予測のしきい値（0〜100 の尺度）。数値が低いほど、より多くの予測が返されます。数値が高いほど、より確信度の高い少数の予測が返されます。<br><br><strong>デフォルト:</strong> 40</p>                                                                                                                                                       |
| stroke     | number  | <p>予測の周囲に表示されるバウンディングボックスの幅（ピクセル単位）（ <code>format</code> が <code>image</code>).<br><br><strong>デフォルト:</strong> 1</p>                                                                                                                                                     |
| labels     | boolean | <p>予測にテキストラベルを表示するかどうか（ <code>format</code> が <code>image</code>).<br><br><strong>デフォルト:</strong> false</p>                                                                                                                                                              |
| format     | string  | <p><strong>json</strong> - JSON 予測の配列を返します。（レスポンス形式タブを参照）。<br><strong>image</strong> - 注釈付き予測の画像を、 <code>Content-Type</code> が <code>image/jpeg</code>. <strong>image\_and\_json</strong> - base64 の可視化フィールドを含む JSON 予測の配列を返します。<br><br><strong>デフォルト</strong>: json</p> |
| api\_key   | string  | ワークスペースの API 設定ページで取得した API キー                                                                                                                                                                                                                                           |

#### リクエスト本文

| 名前 | 型      | 説明                                                |
| -- | ------ | ------------------------------------------------- |
|    | string | base64 エンコードされた画像。（クエリパラメータで画像 URL を渡さない場合は必須です）。 |

{% tabs %}
{% tab title="200 JSON 形式の予測。(x,y) はボックスの" %}

```
{
    "predictions": [{
        "x": 234.0,
        "y": 363.5,
        "width": 160,
        "height": 197,
        "class": "hand",
        "confidence": 0.943
    }, {
        "x": 504.5,
        "y": 363.0,
        "width": 215,
        "height": 172,
        "class": "hand",
        "confidence": 0.917
    }, {
        "x": 1112.5,
        "y": 691.0,
        "width": 139,
        "height": 52,
        "class": "hand",
        "confidence": 0.87
    }, {
        "x": 78.5,
        "y": 700.0,
        "width": 139,
        "height": 34,
        "class": "hand",
        "confidence": 0.404
    }]
}
```

{% endtab %}

{% tab title="403 api\_key にモデルへのアクセス権がない場合。" %}

```
{
    "Message": "このリソースにアクセスする権限がありません"
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.roboflow.com/roboflow/roboflow-jp/deploy/serverless/keypoint-detection.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
