การตรวจจับและติดตามวัตถุ
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ

API การติดตามและการตรวจจับวัตถุในอุปกรณ์ของ ML Kit ช่วยให้คุณตรวจจับและติดตามวัตถุในฟีดรูปภาพหรือฟีดกล้องแบบสดได้
คุณจะเลือกแยกประเภทออบเจ็กต์ที่ตรวจพบได้โดยใช้ตัวแยกประเภทแบบหยาบในตัว API หรือใช้โมเดลการจัดประเภทรูปภาพที่คุณกำหนดเอง ดูการใช้โมเดล TensorFlow Lite ที่กำหนดเองสำหรับข้อมูลเพิ่มเติม
เนื่องจากการตรวจจับและการติดตามวัตถุเกิดขึ้นในอุปกรณ์ ระบบจึงทำงานได้ดีกับส่วนหน้าของไปป์ไลน์การค้นหาภาพ หลังจากที่ตรวจพบและกรองออบเจ็กต์แล้ว คุณจะส่งออบเจ็กต์ไปยังแบ็กเอนด์ระบบคลาวด์ได้ เช่น Cloud Vision Product Search
iOS
Android
ความสามารถหลัก
- การตรวจจับและติดตามวัตถุอย่างรวดเร็ว
ตรวจหาวัตถุและดูตำแหน่งของวัตถุในรูปภาพ ติดตามออบเจ็กต์ในเฟรมรูปภาพ
ที่ประสบความสำเร็จ
- รุ่นอุปกรณ์ที่เพิ่มประสิทธิภาพ
รูปแบบการติดตามและการตรวจจับวัตถุได้รับการเพิ่มประสิทธิภาพสำหรับอุปกรณ์เคลื่อนที่ และใช้ในแอปพลิเคชันแบบเรียลไทม์ แม้ในอุปกรณ์ระดับล่าง
- การตรวจจับวัตถุที่โดดเด่น
ระบุวัตถุที่โดดเด่นที่สุดในรูปภาพโดยอัตโนมัติ
- การจัดประเภทแบบหยาบ
จัดประเภทออบเจ็กต์เป็นหมวดหมู่กว้างๆ ซึ่งใช้กรองสิ่งที่ไม่สนใจได้ เรารองรับหมวดหมู่ต่อไปนี้ ได้แก่ ของใช้ในบ้าน สินค้าแฟชั่น อาหาร พืช และสถานที่
- การจำแนกประเภทด้วยโมเดลที่กำหนดเอง
ใช้โมเดลการจัดประเภทรูปภาพที่คุณกำหนดเองเพื่อระบุหรือกรองหมวดหมู่ออบเจ็กต์ที่เฉพาะเจาะจง ทำให้โมเดลที่กำหนดเองทำงานได้ดีขึ้นโดยทิ้ง
พื้นหลังของรูปภาพไว้
ตัวอย่างผลการแข่ง
การติดตามวัตถุที่โดดเด่นที่สุดในรูปภาพต่างๆ
ตัวอย่างด้านล่างแสดงข้อมูลการติดตามจากเฟรมที่ต่อเนื่อง 3 เฟรมซึ่งมีตัวแยกประเภทแบบคร่าวๆ เริ่มต้นที่ ML Kit ให้ไว้
 |
รหัสติดตาม |
0 |
ขอบเขต |
(95, 45), (496, 45), (496, 240), (95, 240) |
หมวดหมู่ |
ตำแหน่ง |
ความเชื่อมั่นในการแยกประเภท |
0.9296875 |
|
 |
รหัสติดตาม |
0 |
ขอบเขต |
(84, 46), (478, 46), (478, 247), (84, 247) |
หมวดหมู่ |
ตำแหน่ง |
ความเชื่อมั่นในการแยกประเภท |
0.8710938 |
|
 |
รหัสติดตาม |
0 |
ขอบเขต |
(53, 45), (519, 45), (519, 240), (53, 240) |
หมวดหมู่ |
ตำแหน่ง |
ความเชื่อมั่นในการแยกประเภท |
0.8828125 |
|
รูปภาพ: Christian Ferrer [CC BY-SA 4.0]
วัตถุหลายรายการในภาพนิ่ง
ตัวอย่างด้านล่างแสดงข้อมูลของออบเจ็กต์ 4 รายการที่ตรวจพบในรูปภาพโดยใช้ตัวแยกประเภทเริ่มต้นแบบคร่าวๆ ที่ ML Kit มีให้

วัตถุ 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
หากจำเป็น การตรวจจับและการติดตามวัตถุจะใช้การปรับขนาดและยืดรูปภาพแบบ 2 เส้นเพื่อปรับขนาดรูปภาพอินพุตและสัดส่วนภาพให้ตรงตามข้อกำหนดของโมเดลที่วางอยู่
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-08-29 UTC
[null,null,["อัปเดตล่าสุด 2025-08-29 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."]]