影片解讀

Gemini Robotics ER 2 可透過兩項功能,從連續的影片串流追蹤工作進度:

  • 時刻尋找:找出重要事件發生的確切時間戳記。
  • 進度分類:將每部影片歸入五個完成度範圍之一 (0% 至 20%、20% 至 40%、40% 至 60%、60% 至 80%、80% 至 100%)。

尋找重要時刻

時刻發現功能可找出發生重大事件的確切影片影格,例如杯子裝滿水或打結。機器人會使用這項資訊驗證成功、序列步驟,以及觸發修正。

以下範例提示會要求模型找出影片中特定工作完成的時刻:

from google import genai

client = genai.Client()

uploaded_file = client.files.upload(file="task_video.mp4")

prompt = """
At what timestamp (in seconds) does the task reach successful completion?
Return a JSON object: {"completion_time_seconds": <float>}.
If the task is not completed, return {"completion_time_seconds": null}.
"""

interaction = client.interactions.create(
    model="gemini-robotics-er-2-preview",
    input=[
        {
            "type": "video",
            "uri": uploaded_file.uri,
            "mime_type": uploaded_file.mime_type
        },
        {"type": "text", "text": prompt}
    ],
)

print(interaction.output_text)

以下是尋找時刻影片的範例影格,模型會識別工作完成時間戳記:

影片畫面範例,顯示含有時間戳記疊加層的時刻尋找輸出內容

進度分類

進度分類會將影片歸入五個完成度範圍之一:0% 至 20%、20% 至 40%、40% 至 60%、60% 至 80% 或 80% 至 100%。這項功能可讓機器人即時掌握情況,因此不必重新啟動整個工作流程,就能調整動作或重試失敗的步驟。

以下範例提示會要求模型根據影片分類目前的進度等級:

from google import genai

client = genai.Client()

uploaded_file = client.files.upload(file="task_video.mp4")

prompt = """
Watch this video and classify the task progress level at the final frame.
Return a JSON object with the progress bracket:
{"progress_level": "0-20" | "20-40" | "40-60" | "60-80" | "80-100"}.
"""

interaction = client.interactions.create(
    model="gemini-robotics-er-2-preview",
    input=[
        {
            "type": "video",
            "uri": uploaded_file.uri,
            "mime_type": uploaded_file.mime_type
        },
        {"type": "text", "text": prompt}
    ],
)

print(interaction.output_text)

下圖顯示進度分類影片的範例影格,模型會指派進度範圍:

影片影格範例,顯示進度分類輸出內容和進度括號標籤

範例

如需完整的可執行範例 (包括多步驟工作追蹤),請參閱機器人食譜

後續步驟