Gemini Robotics-ER 1.5

‫Gemini Robotics-ER 1.5 הוא מודל ראייה ושפה (VLM) שמביא את יכולות הסוכן של Gemini לרובוטיקה. הוא מיועד לנימוק מתקדם בעולם הפיזי, ומאפשר לרובוטים לפרש נתונים חזותיים מורכבים, לבצע נימוק מרחבי ולתכנן פעולות מפקודות בשפה טבעית.

התכונות והיתרונות העיקריים:

  • אוטונומיה משופרת: רובוטים יכולים להסיק מסקנות, להסתגל ולתת מענה לשינויים בסביבות פתוחות.
  • אינטראקציה בשפה טבעית: מאפשרת להשתמש בשפה טבעית כדי להקצות משימות מורכבות לרובוטים, וכך להקל על השימוש בהם.
  • תיאום משימות: פירוק פקודות בשפה טבעית למשימות משנה ושילוב עם בקרי התנהגות של רובוטים קיימים כדי להשלים משימות ארוכות טווח.
  • יכולות מגוונות: איתור וזיהוי של אובייקטים, הבנה של קשרי גומלין בין אובייקטים, תכנון של אחיזות ומסלולים ופרשנות של סצנות דינמיות.

במסמך הזה מתואר מה המודל עושה, ומוצגות בו כמה דוגמאות שממחישות את היכולות של המודל.

אם רוצים להתחיל מיד, אפשר לנסות את המודל ב-Google AI Studio.

לניסיון ב-Google AI Studio

בטיחות

המודל Gemini Robotics-ER 1.5 נבנה תוך התחשבות בבטיחות, אבל האחריות לשמירה על סביבה בטוחה סביב הרובוט היא שלכם. מודלים של AI גנרטיבי עלולים לטעות, ורובוטים פיזיים עלולים לגרום נזק. הבטיחות היא בראש סדר העדיפויות שלנו, ואנחנו מקדישים מאמצים רבים למחקר בתחום של שימוש בטוח במודלים של AI גנרטיבי בשילוב עם רובוטיקה בעולם האמיתי. מידע נוסף זמין בדף הבטיחות של Google DeepMind בנושא רובוטיקה.

תחילת העבודה: איתור אובייקטים בסצנה

בדוגמה הבאה מוצג תרחיש שימוש נפוץ ברובוטיקה. הדוגמה מראה איך להעביר תמונה והנחיית טקסט למודל באמצעות השיטה generateContent כדי לקבל רשימה של אובייקטים מזוהים עם הנקודות הדו-ממדיות התואמות שלהם. המודל מחזיר נקודות עבור פריטים שהוא זיהה בתמונה, ומחזיר את הקואורדינטות הדו-ממדיות והתוויות המנורמלות שלהם.

אפשר להשתמש בפלט הזה עם API של רובוטיקה, או להפעיל מודל של ראייה-שפה-פעולה (VLA) או כל פונקציה אחרת שמוגדרת על ידי המשתמש של צד שלישי כדי ליצור פעולות לביצוע על ידי רובוט.

Python

from google import genai
from google.genai import types

import IPython
from PIL import Image

# Initialize the GenAI client and specify the model
MODEL_ID = "gemini-robotics-er-1.5-preview"
PROMPT = """
          Point to no more than 10 items in the image. The label returned
          should be an identifying name for the object detected.
          The answer should follow the json format: [{"point": <point>,
          "label": <label1>}, ...]. The points are in [y, x] format
          normalized to 0-1000.
        """
client = genai.Client()

# Load your image
img = Image.open("my-image.png")
img = img.resize((800, int(800 * img.size[1] / img.size[0])), Image.Resampling.LANCZOS) # Resizing to speed-up rendering

image_response = client.models.generate_content(
    model=MODEL_ID,
    contents=[
        img,
        PROMPT
    ],
    config = types.GenerateContentConfig(
        temperature=0.5,
        thinking_config=types.ThinkingConfig(thinking_budget=0)
    )
)

print(image_response.text)

REST

# First, ensure you have the image file locally.
# Encode the image to base64
IMAGE_BASE64=$(base64 -w 0 my-image.png)

curl -X POST \
  "https://generativelanguage.googleapis.com/v1beta/models/gemini-robotics-er-1.5-preview:generateContent \
  -H "x-goog-api-key: $GEMINI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "contents": [
      {
        "parts": [
          {
            "inlineData": {
              "mimeType": "image/png",
              "data": "'"${IMAGE_BASE64}"'"
            }
          },
          {
            "text": "Point to no more than 10 items in the image. The label returned should be an identifying name for the object detected. The answer should follow the json format: [{\"point\": [y, x], \"label\": <label1>}, ...]. The points are in [y, x] format normalized to 0-1000."
          }
        ]
      }
    ],
    "generationConfig": {
      "temperature": 0.5,
      "thinkingConfig": {
        "thinkingBudget": 0
      }
    }
  }'

הפלט יהיה מערך JSON שמכיל אובייקטים, שלכל אחד מהם יש point (קואורדינטות [y, x] מנורמלות) ו-label שמזהה את האובייקט.

JSON

[
  {"point": [376, 508], "label": "small banana"},
  {"point": [287, 609], "label": "larger banana"},
  {"point": [223, 303], "label": "pink starfruit"},
  {"point": [435, 172], "label": "paper bag"},
  {"point": [270, 786], "label": "green plastic bowl"},
  {"point": [488, 775], "label": "metal measuring cup"},
  {"point": [673, 580], "label": "dark blue bowl"},
  {"point": [471, 353], "label": "light blue bowl"},
  {"point": [492, 497], "label": "bread"},
  {"point": [525, 429], "label": "lime"}
]

התמונה הבאה היא דוגמה לאופן שבו אפשר להציג את הנקודות האלה:

דוגמה שמציגה את הנקודות של אובייקטים בתמונה

איך זה עובד

‫Gemini Robotics-ER 1.5 מאפשר לרובוטים שלכם להבין את ההקשר ולעבוד בעולם הפיזי באמצעות הבנה מרחבית. הוא מקבל קלט של תמונות, סרטונים או אודיו, וגם הנחיות בשפה טבעית, כדי:

  • הבנת אובייקטים והקשר של הסצנה: זיהוי אובייקטים והסבר על הקשר שלהם לסצנה, כולל האפשרויות שהם מציעים.
  • הבנת הוראות למשימות: פירוש משימות שניתנות בשפה טבעית, כמו 'תמצא את הבננה'.
  • הסקת מסקנות מרחבית וזמנית: הבנת רצפים של פעולות ואיך אובייקטים מקיימים אינטראקציה עם סצנה לאורך זמן.
  • מספק פלט מובנה: מחזיר קואורדינטות (נקודות או תיבות תוחמות) שמייצגות מיקומי אובייקטים.

כך רובוטים יכולים 'לראות' את הסביבה שלהם ו'להבין' אותה באופן פרוגרמטי.

‫Gemini Robotics-ER 1.5 הוא גם סוכן, כלומר הוא יכול לפרק משימות מורכבות (כמו "שים את התפוח בקערה") למשימות משנה כדי לתזמן משימות לטווח ארוך:

  • חלוקת משימות משנה לרצף: פירוק פקודות לרצף לוגי של שלבים.
  • קריאות לפונקציות/ביצוע קוד: ביצוע שלבים באמצעות קריאה לפונקציות/כלים קיימים של הרובוט או ביצוע קוד שנוצר.

מידע נוסף על הפעלת פונקציות באמצעות Gemini

שימוש בתקציב החשיבה עם Gemini Robotics-ER 1.5

ל-Gemini Robotics-ER 1.5 יש תקציב גמיש של חשיבה שמאפשר לכם לשלוט באיזון בין זמן האחזור לבין הדיוק. במשימות של הבנה מרחבית כמו זיהוי אובייקטים, המודל יכול להשיג ביצועים גבוהים עם תקציב חשיבה קטן. משימות מורכבות יותר של הסקת מסקנות, כמו ספירה ואומדן משקל, נהנות מתקציב חשיבה גדול יותר. כך תוכלו לאזן בין הצורך בתשובות עם זמן אחזור נמוך לבין תוצאות מדויקות מאוד למשימות מורכבות יותר.

מידע נוסף על תקציבי חשיבה זמין בדף יכולות הליבה של Thinking.

יכולות אג'נטיות לרובוטיקה

בקטע הזה נסקור יכולות שונות של Gemini Robotics-ER 1.5, ונראה איך אפשר להשתמש במודל הזה כדי לפתח אפליקציות לזיהוי, להסקת מסקנות ולתכנון רובוטי.

בדוגמאות שבקטע הזה מוצגות יכולות שונות, החל מהצבעה על אובייקטים בתמונה ומציאתם, ועד לתכנון מסלולים ולניהול משימות לטווח ארוך. כדי לפשט את הדברים, קטעי הקוד צומצמו כך שיוצגו ההנחיה והקריאה ל-API של generate_content. קוד מלא שניתן להפעלה ודוגמאות נוספות זמינים בספר המתכונים בנושא רובוטיקה.

הצבעה על אובייקטים

הצבעה על אובייקטים ומציאת אובייקטים בתמונות או בפריים של סרטונים הם תרחישי שימוש נפוצים במודלים של ראייה ושפה (VLMs) ברובוטיקה. בדוגמה הבאה, המודל מתבקש למצוא אובייקטים ספציפיים בתמונה ולהחזיר את הקואורדינטות שלהם בתמונה.

Python

from google import genai
from google.genai import types

# Initialize the GenAI client and specify the model
MODEL_ID = "gemini-robotics-er-1.5-preview"
client = genai.Client()

# Load your image and set up your prompt
  with open('path/to/image-with-objects.jpg', 'rb') as f:
      image_bytes = f.read()

queries = [
    "bread",
    "starfruit",
    "banana",
]

prompt = f"""
    Get all points matching the following objects: {', '.join(queries)}. The
    label returned should be an identifying name for the object detected.
    The answer should follow the json format:
    [\{\{"point": <point>, "label": <label1>\}\}, ...]. The points are in
    [y, x] format normalized to 0-1000.
    """

image_response = client.models.generate_content(
  model=MODEL_ID,
  contents=[
    types.Part.from_bytes(
      data=image_bytes,
      mime_type='image/jpeg',
    ),
    prompt
  ],
  config = types.GenerateContentConfig(
      temperature=0.5,
      thinking_config=types.ThinkingConfig(thinking_budget=0)
  )
)

print(image_response.text)

הפלט יהיה דומה לדוגמה של תחילת העבודה, קובץ JSON שמכיל את הקואורדינטות של האובייקטים שנמצאו ואת התוויות שלהם.

[
  {"point": [671, 317], "label": "bread"},
  {"point": [738, 307], "label": "bread"},
  {"point": [702, 237], "label": "bread"},
  {"point": [629, 307], "label": "bread"},
  {"point": [833, 800], "label": "bread"},
  {"point": [609, 663], "label": "banana"},
  {"point": [770, 483], "label": "starfruit"}
]

דוגמה שבה מוצגות הנקודות של אובייקטים שזוהו בתמונה

משתמשים בהנחיה הבאה כדי לבקש מהמודל לפרש קטגוריות מופשטות כמו 'פירות' במקום אובייקטים ספציפיים, ולאתר את כל המקרים בתמונה.

Python

prompt = f"""
        Get all points for fruit. The label returned should be an identifying
        name for the object detected.
        """ + """The answer should follow the json format:
        [{"point": <point>, "label": <label1>}, ...]. The points are in
        [y, x] format normalized to 0-1000."""

בדף בנושא הבנת תמונות אפשר למצוא טכניקות נוספות לעיבוד תמונות.

מעקב אחרי אובייקטים בסרטון

‫Gemini Robotics-ER 1.5 יכול גם לנתח פריים של סרטונים כדי לעקוב אחרי אובייקטים לאורך זמן. רשימה של פורמטים נתמכים של וידאו זמינה במאמר בנושא קלט וידאו.

זוהי הנחיית הבסיס שמשמשת למציאת אובייקטים ספציפיים בכל פריים שהמודל מנתח:

Python

# Define the objects to find
queries = [
    "pen (on desk)",
    "pen (in robot hand)",
    "laptop (opened)",
    "laptop (closed)",
]

base_prompt = f"""
  Point to the following objects in the provided image: {', '.join(queries)}.
  The answer should follow the json format:
  [\{\{"point": <point>, "label": <label1>\}\}, ...].
  The points are in [y, x] format normalized to 0-1000.
  If no objects are found, return an empty JSON list [].
  """

הפלט מראה עט ומחשב נייד במעקב לאורך פריים הסרטון.

דוגמה שבה אפשר לראות אובייקטים במעקב דרך פריימים ב-GIF

קוד מלא שאפשר להריץ מופיע בספר המתכונים בנושא רובוטיקה.

זיהוי אובייקטים ותיבות תוחמות

בנוסף לנקודות בודדות, המודל יכול להחזיר גם תיבות תוחמות דו-ממדיות, שמספקות אזור מלבני שמקיף אובייקט.

בדוגמה הזו מבוקשות תיבות תוחמות דו-ממדיות לאובייקטים שניתן לזהות על שולחן. המודל קיבל הוראה להגביל את הפלט ל-25 אובייקטים ולתת שם ייחודי לכמה מופעים.

Python

from google import genai
from google.genai import types

# Initialize the GenAI client and specify the model
MODEL_ID = "gemini-robotics-er-1.5-preview"
client = genai.Client()

# Load your image and set up your prompt
  with open('path/to/image-with-objects.jpg', 'rb') as f:
      image_bytes = f.read()

prompt = """
      Return bounding boxes as a JSON array with labels. Never return masks
      or code fencing. Limit to 25 objects. Include as many objects as you
      can identify on the table.
      If an object is present multiple times, name them according to their
      unique characteristic (colors, size, position, unique characteristics, etc..).
      The format should be as follows: [{"box_2d": [ymin, xmin, ymax, xmax],
      "label": <label for the object>}] normalized to 0-1000. The values in
      box_2d must only be integers
      """

  image_response = client.models.generate_content(
    model=MODEL_ID,
    contents=[
      types.Part.from_bytes(
        data=image_bytes,
        mime_type='image/jpeg',
      ),
      prompt
    ],
    config = types.GenerateContentConfig(
        temperature=0.5,
        thinking_config=types.ThinkingConfig(thinking_budget=0)
    )
  )

  print(image_response.text)

בתמונה הבאה מוצגות התיבות שהוחזרו מהמודל.

דוגמה שמציגה תיבות תוחמות לאובייקטים שנמצאו

קוד מלא שניתן להרצה זמין בספר המתכונים בנושא רובוטיקה. בדף Image understanding יש גם דוגמאות נוספות למשימות ויזואליות כמו פילוח וזיהוי אובייקטים.

דוגמאות נוספות לתיבות תוחמות אפשר למצוא בדף הבנת תמונות.

מסלולים

‫Gemini Robotics-ER 1.5 יכול ליצור רצפים של נקודות שמגדירות מסלול, שימושי להנחיית תנועת הרובוט.

בדוגמה הזו יש בקשה ליצור מסלול תנועה להזזת עט אדום למארגן, כולל נקודת ההתחלה וסדרה של נקודות ביניים.

Python

from google import genai
from google.genai import types

# Initialize the GenAI client and specify the model
MODEL_ID = "gemini-robotics-er-1.5-preview"
client = genai.Client()

# Load your image and set up your prompt
  with open('path/to/image-with-objects.jpg', 'rb') as f:
      image_bytes = f.read()

points_data = []
prompt = """
        Place a point on the red pen, then 15 points for the trajectory of
        moving the red pen to the top of the organizer on the left.
        The points should be labeled by order of the trajectory, from '0'
        (start point at left hand) to <n> (final point)
        The answer should follow the json format:
        [{"point": <point>, "label": <label1>}, ...].
        The points are in [y, x] format normalized to 0-1000.
        """

  image_response = client.models.generate_content(
    model=MODEL_ID,
    contents=[
      types.Part.from_bytes(
        data=image_bytes,
        mime_type='image/jpeg',
      ),
      prompt
    ],
    config = types.GenerateContentConfig(
        temperature=0.5,
    )
  )

  print(image_response.text)

התשובה היא קבוצת קואורדינטות שמתארות את מסלול התנועה של העט האדום כדי להשלים את המשימה של העברתו אל ראש הארגונית:

[
  {"point": [550, 610], "label": "0"},
  {"point": [500, 600], "label": "1"},
  {"point": [450, 590], "label": "2"},
  {"point": [400, 580], "label": "3"},
  {"point": [350, 550], "label": "4"},
  {"point": [300, 520], "label": "5"},
  {"point": [250, 490], "label": "6"},
  {"point": [200, 460], "label": "7"},
  {"point": [180, 430], "label": "8"},
  {"point": [160, 400], "label": "9"},
  {"point": [140, 370], "label": "10"},
  {"point": [120, 340], "label": "11"},
  {"point": [110, 320], "label": "12"},
  {"point": [105, 310], "label": "13"},
  {"point": [100, 305], "label": "14"},
  {"point": [100, 300], "label": "15"}
]

דוגמה שמציגה את המסלול המתוכנן

תזמור

‫Gemini Robotics-ER 1.5 יכול לבצע ניתוח מרחבי ברמה גבוהה יותר, להסיק פעולות או לזהות מיקומים אופטימליים על סמך הבנה הקשרית.

מפנים מקום למחשב נייד

בדוגמה הזו אפשר לראות איך Gemini Robotics-ER מנתח מרחב. ההנחיה מבקשת מהמודל לזהות איזה אובייקט צריך להזיז כדי ליצור מקום לפריט אחר.

Python

from google import genai
from google.genai import types

# Initialize the GenAI client and specify the model
MODEL_ID = "gemini-robotics-er-1.5-preview"
client = genai.Client()

# Load your image and set up your prompt
  with open('path/to/image-with-objects.jpg', 'rb') as f:
      image_bytes = f.read()

prompt = """
          Point to the object that I need to remove to make room for my laptop
          The answer should follow the json format: [{"point": <point>,
          "label": <label1>}, ...]. The points are in [y, x] format normalized to 0-1000.
        """

  image_response = client.models.generate_content(
    model=MODEL_ID,
    contents=[
      types.Part.from_bytes(
        data=image_bytes,
        mime_type='image/jpeg',
      ),
      prompt
    ],
    config = types.GenerateContentConfig(
        temperature=0.5,
        thinking_config=types.ThinkingConfig(thinking_budget=0)
    )
  )

  print(image_response.text)

התגובה מכילה קואורדינטה דו-ממדית של האובייקט שנותן מענה לשאלה של המשתמש. במקרה הזה, האובייקט שצריך להזיז כדי לפנות מקום למחשב נייד.

[
  {"point": [672, 301], "label": "The object that I need to remove to make room for my laptop"}
]

דוגמה שמראה איזה אובייקט צריך להעביר כדי שאובייקט אחר

אריזת ארוחת צהריים

המודל יכול גם לספק הוראות למשימות מרובות שלבים ולהצביע על אובייקטים רלוונטיים לכל שלב. בדוגמה הזו אפשר לראות איך המודל מתכנן סדרה של שלבים לאריזת ארוחת צהריים בתיק.

Python

from google import genai
from google.genai import types

# Initialize the GenAI client and specify the model
MODEL_ID = "gemini-robotics-er-1.5-preview"
client = genai.Client()

# Load your image and set up your prompt
  with open('path/to/image-of-lunch.jpg', 'rb') as f:
      image_bytes = f.read()

prompt = """
          Explain how to pack the lunch box and lunch bag. Point to each
          object that you refer to. Each point should be in the format:
          [{"point": [y, x], "label": }], where the coordinates are
          normalized between 0-1000.
        """

  image_response = client.models.generate_content(
    model=MODEL_ID,
    contents=[
      types.Part.from_bytes(
        data=image_bytes,
        mime_type='image/jpeg',
      ),
      prompt
    ],
    config = types.GenerateContentConfig(
        temperature=0.5,
        thinking_config=types.ThinkingConfig(thinking_budget=0)
    )
  )

  print(image_response.text)

התגובה להנחיה הזו היא סדרה של הוראות מפורטות לאריזת ארוחת צהריים בתיק, על סמך התמונה שמוזנת.

תמונת הקלט

תמונה של קופסת אוכל ופריטים שאפשר להכניס לתוכה

פלט המודל

Based on the image, here is a plan to pack the lunch box and lunch bag:

1.  **Pack the fruit into the lunch box.** Place the [apple](apple), [banana](banana), [red grapes](red grapes), and [green grapes](green grapes) into the [blue lunch box](blue lunch box).
2.  **Add the spoon to the lunch box.** Put the [blue spoon](blue spoon) inside the lunch box as well.
3.  **Close the lunch box.** Secure the lid on the [blue lunch box](blue lunch box).
4.  **Place the lunch box inside the lunch bag.** Put the closed [blue lunch box](blue lunch box) into the [brown lunch bag](brown lunch bag).
5.  **Pack the remaining items into the lunch bag.** Place the [blue snack bar](blue snack bar) and the [brown snack bar](brown snack bar) into the [brown lunch bag](brown lunch bag).

Here is the list of objects and their locations:
*   [{"point": [899, 440], "label": "apple"}]
*   [{"point": [814, 363], "label": "banana"}]
*   [{"point": [727, 470], "label": "red grapes"}]
*   [{"point": [675, 608], "label": "green grapes"}]
*   [{"point": [706, 529], "label": "blue lunch box"}]
*   [{"point": [864, 517], "label": "blue spoon"}]
*   [{"point": [499, 401], "label": "blue snack bar"}]
*   [{"point": [614, 705], "label": "brown snack bar"}]
*   [{"point": [448, 501], "label": "brown lunch bag"}]

קריאה ל-API של רובוט בהתאמה אישית

בדוגמה הזו מוצגת תזמור משימות באמצעות API של רובוט בהתאמה אישית. הוא כולל API מדומה שנועד לפעולת הרמה והנחה. המשימה היא להרים קובייה כחולה ולהניח אותה בקערה בצבע כתום:

תמונה של הבלוק והקערה

בדומה לדוגמאות האחרות בדף הזה, קוד מלא שניתן להפעלה זמין בספר המתכונים בנושא רובוטיקה.

השלב הראשון הוא לאתר את שני הפריטים באמצעות ההנחיה הבאה:

Python

prompt = """
            Locate and point to the blue block and the orange bowl. The label
            returned should be an identifying name for the object detected.
            The answer should follow the json format: [{"point": <point>, "label": <label1>}, ...].
            The points are in [y, x] format normalized to 0-1000.
          """

התשובה של המודל כוללת את הקואורדינטות המנורמלות של הבלוק והקערה:

[
  {"point": [389, 252], "label": "orange bowl"},
  {"point": [727, 659], "label": "blue block"}
]

בדוגמה הזו נעשה שימוש ב-API מדומה של רובוט:

Python

def move(x, y, high):
  print(f"moving to coordinates: {x}, {y}, {15 if high else 5}")

def setGripperState(opened):
  print("Opening gripper" if opened else "Closing gripper")

def returnToOrigin():
  print("Returning to origin pose")

השלב הבא הוא הפעלת רצף של פונקציות API עם הלוגיקה הנדרשת לביצוע הפעולה. ההנחיה הבאה כוללת תיאור של ה-API של הרובוט שבו המודל צריך להשתמש כדי לתזמן את המשימה הזו.

Python

prompt = f"""
    You are a robotic arm with six degrees-of-freedom. You have the
    following functions available to you:

    def move(x, y, high):
      # moves the arm to the given coordinates. The boolean value 'high' set
      to True means the robot arm should be lifted above the scene for
      avoiding obstacles during motion. 'high' set to False means the robot
      arm should have the gripper placed on the surface for interacting with
      objects.

    def setGripperState(opened):
      # Opens the gripper if opened set to true, otherwise closes the gripper

    def returnToOrigin():
      # Returns the robot to an initial state. Should be called as a cleanup
      operation.

    The origin point for calculating the moves is at normalized point
    y={robot_origin_y}, x={robot_origin_x}. Use this as the new (0,0) for
    calculating moves, allowing x and y to be negative.
    Perform a pick and place operation where you pick up the blue block at
    normalized coordinates ({block_x}, {block_y}) (relative coordinates:
    {block_relative_x}, {block_relative_y}) and place it into the orange
    bowl at normalized coordinates ({bowl_x}, {bowl_y})
    (relative coordinates: {bowl_relative_x}, {bowl_relative_y}).
    Provide the sequence of function calls as a JSON list of objects, where
    each object has a "function" key (the function name) and an "args" key
    (a list of arguments for the function).
    Also, include your reasoning before the JSON output.
    For example:
    Reasoning: To pick up the block, I will first move the arm to a high
    position above the block, open the gripper, move down to the block,
    close the gripper, lift the arm, move to a high position above the bowl,
    move down to the bowl, open the gripper, and then lift the arm back to
    a high position.
"""

בדוגמה הבאה מוצג פלט אפשרי של המודל על סמך ההנחיה וממשק ה-API של הרובוט המדומה. הפלט כולל את תהליך החשיבה של המודל ואת המשימות שהוא תכנן כתוצאה מכך. מוצג גם הפלט של הקריאות לפונקציות של הרובוט שהמודל סידר ברצף.

Reasoning: To perform the pick and place operation, I will first move the
robotic arm to a high position above the blue block to ensure clearance. Then, I
will open the gripper in preparation for grasping. Next, I will lower the arm to
the surface level to position the gripper around the block and close the gripper
to secure it. After picking up the block, I will lift the arm to clear the
surface and move towards the orange bowl, maintaining a high position to avoid
collisions. Once positioned above the bowl, I will lower the arm to place the
block inside. I will then open the gripper to release the block. Finally, I will
lift the arm out of the bowl and call `returnToOrigin` to reset the robot's
state.

[
  {
    "function": "move",
    "args": [
      163,
      427,
      true
    ]
  },
  {
    "function": "setGripperState",
    "args": [
      true
    ]
  },
  {
    "function": "move",
    "args": [
      163,
      427,
      false
    ]
  },
  {
    "function": "setGripperState",
    "args": [
      false
    ]
  },
  {
    "function": "move",
    "args": [
      163,
      427,
      true
    ]
  },
  {
    "function": "move",
    "args": [
      -247,
      90,
      true
    ]
  },
  {
    "function": "move",
    "args": [
      -247,
      90,
      false
    ]
  },
  {
    "function": "setGripperState",
    "args": [
      true
    ]
  },
  {
    "function": "move",
    "args": [
      -247,
      90,
      true
    ]
  },
  {
    "function": "returnToOrigin",
    "args": []
  }
]


Executing Function Calls:
moving to coordinates: 163, 427, 15
Opening gripper
moving to coordinates: 163, 427, 5
Closing gripper
moving to coordinates: 163, 427, 15
moving to coordinates: -247, 90, 15
moving to coordinates: -247, 90, 5
Opening gripper
moving to coordinates: -247, 90, 15
Returning to origin pose

ביצוע קוד

‫Gemini Robotics-ER 1.5 יכול להציע ולהריץ קוד Python כדי לבצע משימות שדורשות פעולות דינמיות, כמו הגדלה של אזור בתמונה כדי לראות פרטים טובים יותר.

בדוגמה הזו אפשר לראות איך המודל מציע להשתמש בכלי הפעלת קוד כדי לבצע 'התמקדות' באזור מסוים בתמונה, ואז מבצע את הפעולה כדי לענות על השאלה של המשתמש.

Python

from google import genai
from google.genai import types

client = genai.Client()

MODEL_ID = "gemini-robotics-er-1.5-preview"

# Load your image and set up your prompt
  with open('path/to/image-of-object.jpg', 'rb') as f:
      image_bytes = f.read()
prompt = """
          What is the air quality reading? Using the code execution feature,
          zoom in on the image to take a closer look.
        """

response = client.models.generate_content(
    model=MODEL_ID,
    contents=[
        img,
        prompt
    ],
    config = types.GenerateContentConfig(
        temperature=0.5,
        tools=[types.Tool(code_execution=types.ToolCodeExecution)]
    )
)

for part in response.candidates[0].content.parts:
    if part.text is not None:
        print(part.text)
    if part.executable_code is not None:
        print(part.executable_code.code)
    if part.code_execution_result is not None:
        print(part.code_execution_result.output)

התשובה הבאה היא תשובה אפשרית של המודל למשימה הזו. הפלט מראה שהמודל יוצר קוד להגדלת התמונה כדי לקרוא את המסך בצורה טובה יותר. הוא גם מציג את תהליך החשיבה מאחורי ההתאמות שבוצעו בחיתוך. פלט לדוגמה מלא אפשר לראות בספר המתכונים בנושא רובוטיקה.

# Detect relevant objects and output in json format
# [{"box_2d": [379, 407, 481, 553], "label": "display"}]
from PIL import Image

# Open the image
img = Image.open("input_file_0.jpeg")

# Define the coordinates for cropping (normalized to 0-1000)
# Based on visual inspection, the display is roughly centered around [430, 430] to [500, 500] in a 1000x1000 scale.
# Let's try to zoom in on the display area.
# Bounding box for display: [ymin, xmin, ymax, xmax] in pixels.
# From visual inspection of the original image (size 90489 bytes, resolution
unknown but let's assume a standard aspect ratio and roughly 1000x1000 for
relative positioning),
# the display is located at approximately y=380-480, x=410-540.
# Let's define a larger area around it for context.
# Let's say we want to crop from y=350 to y=550 and x=350 to x=650.

...

thought
The crop was too tight and only captured part of the display. Let's adjust the bounding box.
The previous crop was `img.crop((400, 350, 600, 500))`. This means xmin=400, ymin=350, xmax=600, ymax=500.
The display is centered around x=480, y=430.
The previous crop captured the left side of the display.
Let's expand the x range to the right and y range to cover the whole circle.
New bounding box estimate: ymin=370, xmin=400, ymax=500, xmax=600.
Let's try again with a wider crop.
# Detect relevant objects and output in json format
# [{"box_2d": [379, 407, 481, 553], "label": "display"}]
from PIL import Image

# Open the image
img = Image.open("input_file_0.jpeg")

# Define the coordinates for cropping (normalized to 0-1000)
…

The reading of 14 falls into the "Moderate" category.
The prompt asks for the "air quality reading", which can be interpreted as
either the numerical value or the categorical description. Given the numerical
value is explicitly displayed, it's the primary reading.

Let's provide the numerical value as the reading.
The reading is 014.
Based on the display on the air purifier, the air quality reading is **014**.

שיטות מומלצות

כדי לבצע אופטימיזציה של הביצועים והדיוק של אפליקציות רובוטיקה, חשוב להבין איך ליצור אינטראקציה יעילה עם מודל Gemini. בקטע הזה מפורטות שיטות מומלצות ואסטרטגיות מרכזיות ליצירת הנחיות, לטיפול בנתונים חזותיים ולבניית משימות כדי להשיג את התוצאות הכי אמינות.

  1. השתמש בשפה ברורה ופשוטה.

    • משתמשים בשפה טבעית: מודל Gemini נועד להבין שפה טבעית, כמו בשיחה רגילה. כדאי לנסח את ההנחיות בצורה ברורה מבחינה סמנטית, שתשקף את האופן שבו אדם נותן הוראות באופן טבעי.

    • שימוש במינוח יומיומי: עדיף להשתמש בשפה יומיומית ולא בז'רגון טכני או מקצועי. אם המודל לא מגיב למונח מסוים כמו שציפיתם, נסו לנסח אותו מחדש באמצעות מילה נרדפת נפוצה יותר.

  2. אופטימיזציה של הקלט החזותי.

    • הגדלת התצוגה כדי לראות פרטים: כשמנתחים אובייקטים קטנים או כאלה שקשה להבחין בהם בצילום רחב, אפשר להשתמש בפונקציית תיבת תוחמת כדי לבודד את האובייקט הרצוי. אחר כך אפשר לחתוך את התמונה לפי האזור הזה ולשלוח את התמונה החדשה והממוקדת למודל כדי לקבל ניתוח מפורט יותר.

    • ניסוי עם תאורה וצבע: תנאי תאורה מאתגרים וניגודיות צבעים נמוכה יכולים להשפיע על התפיסה של המודל.

  3. כדאי לחלק בעיות מורכבות לשלבים קטנים יותר. אם תתייחסו לכל שלב קטן בנפרד, תוכלו להנחות את המודל להגיע לתוצאה מדויקת ומוצלחת יותר.

  4. שיפור הדיוק באמצעות קונצנזוס. למשימות שדורשות רמת דיוק גבוהה, אפשר לשלוח למודל את אותה הנחיה כמה פעמים. על ידי חישוב ממוצע של התוצאות שמתקבלות, אפשר להגיע ל "הסכמה" שהיא לרוב מדויקת ואמינה יותר.

מגבלות

כשמפתחים באמצעות Gemini Robotics-ER 1.5, חשוב להביא בחשבון את המגבלות הבאות:

  • סטטוס התצוגה המקדימה: המודל נמצא כרגע בתצוגה מקדימה. יכול להיות שיהיו שינויים בממשקי ה-API וביכולות, ולכן יכול להיות שהם לא יתאימו לאפליקציות קריטיות לייצור בלי בדיקה יסודית.
  • זמן אחזור: שאילתות מורכבות, קלט ברזולוציה גבוהה או נתונים נרחבים thinking_budget יכולים להוביל לזמני עיבוד ארוכים יותר.
  • הזיות: כמו כל המודלים הגדולים של שפה, Gemini Robotics-ER 1.5 יכול מדי פעם "להזות" או לספק מידע שגוי, במיוחד כשמזינים לו הנחיות מעורפלות או נתונים שלא תואמים לנתוני האימון שלו.
  • תלות באיכות ההנחיה: איכות הפלט של המודל תלויה מאוד בבהירות ובספציפיות של ההנחיה. הנחיות עמומות או לא מובְנות היטב עלולות להוביל לתוצאות לא אופטימליות.
  • עלות חישובית: הפעלת המודל, במיוחד עם נתוני וידאו או עם thinking_budget גבוה, צורכת משאבים חישוביים וגוררת עלויות. פרטים נוספים מופיעים בדף חשיבה.
  • סוגי קלט: בקישורים הבאים מפורטות המגבלות של כל מצב.

הודעת פרטיות

אתם מאשרים שהמודלים שמצוינים במסמך הזה ('מודלים של רובוטיקה') משתמשים בנתוני וידאו ואודיו כדי לפעול ולהזיז את החומרה בהתאם להוראות שלכם. לכן, יכול להיות שתפעילו את המודלים של הרובוטיקה באופן כזה שבו נתונים מאנשים שאפשר לזהות, כמו נתוני קול, תמונות ודמיון ("מידע אישי"), ייאספו על ידי המודלים של הרובוטיקה. אם תבחרו להפעיל את מודלי הרובוטיקה באופן שבו נאסף מידע אישי, אתם מסכימים שלא תאפשרו לאנשים שניתן לזהות אותם ליצור אינטראקציה עם מודלי הרובוטיקה או להיות נוכחים באזור שמסביבם, אלא אם ועד שאנשים כאלה יקבלו הודעה מספקת על כך שהמידע האישי שלהם עשוי להימסר ל-Google ולשמש אותה כפי שמפורט בתנאים הנוספים של Gemini API שזמינים בכתובת https://ai.google.dev/gemini-api/terms (התנאים), כולל בהתאם לקטע שכותרתו 'איך Google משתמשת בנתונים שלכם'. עליך לוודא שההודעה מאפשרת את האיסוף והשימוש במידע אישי כפי שמתואר בתנאים, ועליך להשתמש במאמצים סבירים מבחינה מסחרית כדי לצמצם את האיסוף וההפצה של מידע אישי באמצעות טכניקות כמו טשטוש פנים והפעלת המודלים של הרובוטיקה באזורים שלא מכילים אנשים שניתן לזהות, במידת האפשר.

תמחור

מידע מפורט על התמחור והאזורים הזמינים מופיע בדף התמחור.

השלבים הבאים