オブジェクトの検出とトラッキング
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。

ML Kit のオンデバイス オブジェクト検出およびトラッキング API を使用すると、画像フィードやライブカメラフィード内のオブジェクトを検出して追跡できます。
必要に応じて、API に組み込まれている大まかな分類器を使用するか、独自のカスタム画像分類モデルを使用して、検出されたオブジェクトを分類できます。詳細については、カスタム TensorFlow Lite モデルの使用をご覧ください。
オブジェクトの検出とトラッキングはデバイス上で行われるため、ビジュアル検索パイプラインのフロントエンドとしても機能します。オブジェクトを検出してフィルタしたら、Cloud Vision Product Search などのクラウド バックエンドに渡すことができます。
iOS
Android
主な機能
- 高速なオブジェクト検出とトラッキング
オブジェクトを検出して、画像内の位置を取得します。連続する画像フレーム間でオブジェクトを追跡します。
- オンデバイス モデルの最適化
オブジェクトの検出とトラッキング モデルは、モバイル デバイス向けに最適化されており、ローエンド デバイスでも、リアルタイム アプリケーションでの使用を想定しています。
- 認識しやすいオブジェクトの検出
画像内で最も視認性の高いオブジェクトを自動的に検出します。
- 大まかな分類: オブジェクトを広範なカテゴリに分類します。このカテゴリを使用すると、不要なオブジェクトを除外できます。サポートされているカテゴリは、日用品、ファッション アイテム、食品、植物、場所です。
- カスタムモデルによる分類
独自のカスタム画像分類モデルを使用して、特定のオブジェクト カテゴリを識別またはフィルタリングします。画像の背景を除外することで、カスタムモデルのパフォーマンスを向上させることができます。
検索結果の例
最も目立つオブジェクトを画像間でトラッキングする
以下の例は、ML Kit で提供されるデフォルトの粗い分類器を使用した、3 つの連続するフレームのトラッキング データを示しています。
 |
トラッキング ID |
0 |
境界 |
(95, 45)、(496, 45)、(496, 240)、(95, 240) |
カテゴリ |
場所 |
分類の信頼度 |
0.9296875 |
|
 |
トラッキング ID |
0 |
境界 |
(84, 46)、(478, 46)、(478, 247)、(84, 247) |
カテゴリ |
場所 |
分類の信頼度 |
0.8710938 |
|
 |
トラッキング ID |
0 |
境界 |
(53, 45)、(519, 45)、(519, 240)、(53, 240) |
カテゴリ |
場所 |
分類の信頼度 |
0.8828125 |
|
写真: Christian Ferrer [CC BY-SA 4.0]
静止画像内の複数のオブジェクト
以下の例は、ML Kit に用意されているデフォルトの粗い分類器を使用して、画像から検出された 4 つのオブジェクトのデータを示しています。

オブジェクト 0 |
境界 |
(1, 97)、(332, 97)、(332, 332)、(1, 332) |
カテゴリ |
FASHION_GOOD |
分類の信頼度 |
0.95703125 |
オブジェクト 1 |
境界 |
(186, 80)、(337, 80)、(337, 226)、(186, 226) |
カテゴリ |
FASHION_GOOD |
分類の信頼度 |
0.84375 |
オブジェクト 2 |
境界 |
(296, 80)、(472, 80)、(472, 388)、(296, 388) |
カテゴリ |
FASHION_GOOD |
分類の信頼度 |
0.94921875 |
オブジェクト 3 |
境界 |
(439, 83)、(615, 83)、(615, 306)、(439, 306) |
カテゴリ |
FASHION_GOOD |
分類の信頼度 |
0.9375 |
カスタム TensorFlow Lite モデルの使用
デフォルトの大まかな分類器は 5 つのカテゴリ用に作成され、検出されたオブジェクトに関する限定的な情報を提供します。たとえば、花の種類や食べ物の種類を区別するモデルなど、より狭いコンセプト領域をより詳細にカバーする、より特殊な分類器モデルが必要になる場合があります。
この API を使用すると、幅広いソースからのカスタム画像分類モデルをサポートすることで、特定のユースケースに合わせてカスタマイズできます。詳細については、ML Kit によるカスタムモデルをご覧ください。カスタムモデルは、アプリにバンドルすることも、Firebase Machine Learning のモデルデプロイ サービスを使用してクラウドから動的にダウンロードすることもできます。
iOS
Android
オブジェクトの検出とトラッキングでは、必要に応じて、バイリニア画像のスケーリングとストレッチを使用して、基盤となるモデルの要件に合うように入力画像のサイズとアスペクト比を調整します。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-09-03 UTC。
[null,null,["最終更新日 2025-09-03 UTC。"],[[["\u003cp\u003eML Kit's on-device API enables detection and tracking of objects within images or live camera feeds, working efficiently even on lower-end mobile devices.\u003c/p\u003e\n"],["\u003cp\u003eIt offers optional object classification using a built-in coarse classifier or your own custom TensorFlow Lite model for more specialized categorization.\u003c/p\u003e\n"],["\u003cp\u003eThe API can identify the most prominent object in an image and track it across frames, making it suitable for visual search applications.\u003c/p\u003e\n"],["\u003cp\u003eCustom models can be integrated to classify objects into specific categories, enhancing the functionality for tailored use cases.\u003c/p\u003e\n"],["\u003cp\u003eInput images are automatically preprocessed to fit model requirements, using bilinear scaling and stretching if necessary.\u003c/p\u003e\n"]]],["ML Kit's API enables on-device object detection and tracking in images or live feeds, optionally classifying them. It features fast detection, an optimized model for mobile, and prominent object identification. Objects can be classified into broad categories or with custom models. The API supports custom image classification models, including ones dynamically downloaded. Detected objects are tracked across frames, and the system adjusts input image size and aspect ratio as needed.\n"],null,["With ML Kit's on-device object detection and tracking API, you can detect\nand track objects in an image or live camera feed.\n\nOptionally, you can classify detected objects, either by using the coarse\nclassifier built into the API, or using your own custom image classification\nmodel. See [Using a custom TensorFlow Lite model](#custom-tflite) for more\ninformation.\n\nBecause object detection and tracking happens on the device, it works well as\nthe front end of the visual search pipeline. After you detect and filter\nobjects, you can pass them to a cloud backend, such as\n[Cloud Vision Product Search](https://cloud.google.com/vision/product-search/docs/).\n\n[iOS](/ml-kit/vision/object-detection/ios)\n[Android](/ml-kit/vision/object-detection/android)\n\nKey capabilities\n\n- **Fast object detection and tracking** Detect objects and get their locations in the image. Track objects across successive image frames.\n- **Optimized on-device model** The object detection and tracking model is optimized for mobile devices and intended for use in real-time applications, even on lower-end devices.\n- **Prominent object detection** Automatically determine the most prominent object in an image.\n- **Coarse classification** Classify objects into broad categories, which you can use to filter out objects you're not interested in. The following categories are supported: home goods, fashion goods, food, plants, and places.\n- **Classification with a custom model** Use your own custom image classification model to identify or filter specific object categories. Make your custom model perform better by leaving out background of the image.\n\nExample results\n\nTracking the most prominent object across images\n\nThe example below shows the tracking data from three successive frames with the\ndefault coarse classifier provided by ML Kit.\n\n|---|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| | |---------------------------|--------------------------------------------| | Tracking ID | 0 | | Bounds | (95, 45), (496, 45), (496, 240), (95, 240) | | Category | PLACE | | Classification confidence | 0.9296875 | |\n| | |---------------------------|--------------------------------------------| | Tracking ID | 0 | | Bounds | (84, 46), (478, 46), (478, 247), (84, 247) | | Category | PLACE | | Classification confidence | 0.8710938 | |\n| | |---------------------------|--------------------------------------------| | Tracking ID | 0 | | Bounds | (53, 45), (519, 45), (519, 240), (53, 240) | | Category | PLACE | | Classification confidence | 0.8828125 | |\n\nPhoto: Christian Ferrer \\[CC BY-SA 4.0\\]\n\nMultiple objects in a static image\n\nThe example below shows the data for the four objects detected in the image with\nthe default coarse classifier provided by ML Kit.\n\n| Object 0 ||\n|---------------------------|----------------------------------------------|\n| Bounds | (1, 97), (332, 97), (332, 332), (1, 332) |\n| Category | FASHION_GOOD |\n| Classification confidence | 0.95703125 |\n| Bounds | (186, 80), (337, 80), (337, 226), (186, 226) |\n| Category | FASHION_GOOD |\n| Classification confidence | 0.84375 |\n| Bounds | (296, 80), (472, 80), (472, 388), (296, 388) |\n| Category | FASHION_GOOD |\n| Classification confidence | 0.94921875 |\n| Bounds | (439, 83), (615, 83), (615, 306), (439, 306) |\n| Category | FASHION_GOOD |\n| Classification confidence | 0.9375 |\n\nUsing a custom TensorFlow Lite model\n\nThe default coarse classifier is built for five categories, providing limited\ninformation about the detected objects. You might need a more specialized\nclassifier model that covers a narrower domain of concepts in more detail;\nfor example, a model to distinguish between species of flowers or types of\nfood.\n\nThis API lets you tailor to a particular use case by by supporting custom image\nclassification models from a wide range of sources. Please refer to\n[Custom models with ML Kit](/ml-kit/custom-models) to learn more. Custom models\ncan be bundled with your app or dynamically downloaded from the cloud using\nFirebase Machine Learning's Model deployment service.\n\n[iOS](/ml-kit/vision/object-detection/custom-models/ios)\n[Android](/ml-kit/vision/object-detection/custom-models/android)\n\nInput image preprocessing\n\nIf needed, object detection and tracking uses bilinear image scaling and\nstretching to adjust the input image size and aspect ratio so that they fit the\nrequirements of the underlying model."]]