# APIを介してVisual Artificial Intelligence (AI)予測を行う

> APIを介してVisual Artificial Intelligence (AI)予測を行う - API呼び出しを使用してVisual Artificial Intelligence
> (AI)プロジェクトで予測を行う方法を学びます。

This Markdown file sits beside the HTML page at the same path (with a `.md` suffix). It summarizes the topic and lists links for tools and LLM context.

Companion generated at `2026-07-15T05:55:44.638427+00:00` (UTC).

## Primary page

- [APIを介してVisual Artificial Intelligence (AI)予測を行う](https://docs.datarobot.com/ja/docs/api/dev-learning/python/py-code-examples/prediction-examples/vai-pred.html.md): Full documentation for this topic (Markdown sidecar).

## Sections on this page

- [要点](https://docs.datarobot.com/ja/docs/api/dev-learning/python/py-code-examples/prediction-examples/vai-pred.html.md#takeaways): In-page section heading.
- [予測ワークフロー](https://docs.datarobot.com/ja/docs/api/dev-learning/python/py-code-examples/prediction-examples/vai-pred.html.md#predictions-workflow): In-page section heading.
- [学習リソース](https://docs.datarobot.com/ja/docs/api/dev-learning/python/py-code-examples/prediction-examples/vai-pred.html.md#learn-more): In-page section heading.
- [ドキュメンテーション](https://docs.datarobot.com/ja/docs/api/dev-learning/python/py-code-examples/prediction-examples/vai-pred.html.md#documentation): In-page section heading.

## Documentation content

このチュートリアルでは、API呼び出しを使用してVisual Artificial Intelligence (AI)プロジェクトで予測を行う方法の概要を説明します。
このチュートリアルを完了するには、Visual Artificial Intelligence (AI)モデルをトレーニングしてデプロイしている必要があります。

## 要点

このチュートリアルでは、次の方法を示します。

- Configure scripting code for making batch predictions via the API
- Make an API call to get batch predictions for a visual AI model
- Format images to a base64 format

## 予測ワークフロー

1. Prepare your data for Visual Artificial Intelligence (AI). Before making predictions, convert the images you want to score tobase64 format(the standard format for handling images in API calls). モデルが予測結果を返す場合、画像はbase64形式で返されることに注意してください。 To convert data, use DataRobot's Python package, described in the guidePreparing binary data for predictions.
2. After training and deploying a Visual Artificial Intelligence (AI) model, navigate to the deployment and access thePredictions > Prediction APItab. このタブは、APIを介して予測を行うために使用されるスクリプトコードを提供します。
3. To configure the scripting code, selectBatchas the prediction type andAPI Clientas the interface type.
4. Copy the code and save it as a Python script (e.g.,datarobot-predict.py). スクリプトを編集して、追加の手順を組み込むことができます。 たとえば、入力ファイル（例image_id）の列を出力ファイルに含める場合は、passthrough_columns_setに引数をBatchPredictionJobに追加します。
5. Using the scripting code fromstep twoand a base64-converted image file (InputDataConverted.csv), make an API call to get predictions from the deployed model: python datarobot-predict.py InputDataConverted.csv Predictions.csv
6. Access the output file (Predictions.csv) to view prediction results.

## 学習リソース

**追加のツール**

base64変換プロセスを支援するスクリプトを含むデータ準備ツールについては、 [DataRobot Community GitHub](https://github.com/datarobot-community/visual-ai-data-prep/blob/master/visualai_data_prep.py) ページをご参照ください。 このリンクをクリックする前にGitHubにログインしてください。

このチュートリアルで使用されるスクリプトコードの詳細については、 [Pythonパッケージのドキュメント](https://datarobot-public-api-client.readthedocs-hosted.com/) をご参照ください。

**多クラスの例**

手順6の多クラス分類問題の予測結果の場合、予測の出力結果ファイルには、画像が各クラスに分類される確率、最も確率の高いクラス名、およびPythonスコアリングスクリプトから要求された他のすべてのオプションの列（ `prediction_status` と `image_id` のように）が含まれていることに注意してください。

## ドキュメンテーション

- Visual Artificial Intelligence (AI)の概要
- Making predictions with Visual Artificial Intelligence (AI)
- Prediction API overview
