Gemini Robotics-ER 1.5 هو نموذج للرؤية واللغة (VLM) يتيح استخدام إمكانات Gemini الخاصة بالوكلاء في مجال الروبوتات. وهي مصمّمة لإجراء عمليات استنتاج متقدّمة في العالم المادي، ما يتيح للروبوتات تفسير البيانات المرئية المعقّدة وإجراء عمليات استنتاج مكانية وتخطيط الإجراءات من خلال الأوامر باللغة الطبيعية.
الميزات والمزايا الرئيسية:
- الاستقلالية المحسّنة: يمكن للروبوتات التفكير والتكيّف والاستجابة للتغييرات في البيئات المفتوحة.
- التفاعل باللغة الطبيعية: يسهّل استخدام الروبوتات من خلال السماح بتعيين مهام معقّدة باستخدام اللغة الطبيعية.
- تنظيم المهام: يتم تقسيم أوامر اللغة الطبيعية إلى مهام فرعية، ودمجها مع وحدات التحكّم والسلوكيات الحالية للروبوتات من أجل إكمال المهام الطويلة الأمد.
- إمكانات متعدّدة الاستخدامات: تحديد مواقع العناصر والتعرّف عليها، وفهم العلاقات بين العناصر، وتخطيط عمليات الإمساك والمسارات، وتفسير المشاهد الديناميكية
يوضّح هذا المستند وظيفة النموذج ويقدّم لك عدة أمثلة تسلّط الضوء على إمكانات النموذج المستندة إلى الذكاء الاصطناعي.
إذا أردت البدء على الفور، يمكنك تجربة النموذج في Google AI Studio.
تجربة الميزة في Google AI Studio
الأمان
على الرغم من أنّ Gemini Robotics-ER 1.5 مصمَّم مع مراعاة السلامة، تقع على عاتقك مسؤولية الحفاظ على بيئة آمنة حول الروبوت. قد ترتكب نماذج الذكاء الاصطناعي التوليدي أخطاء، وقد تتسبّب الروبوتات المادية في حدوث أضرار. نولي السلامة أهمية قصوى، لذا نعمل حاليًا على تطوير نماذج ذكاء اصطناعي توليدي آمنة للاستخدام مع الروبوتات في العالم الحقيقي، وهذا مجال مهم وحيوي في أبحاثنا. لمزيد من المعلومات، يُرجى الانتقال إلى صفحة أمان الروبوتات في Google DeepMind.
البدء: العثور على عناصر في مشهد
يوضّح المثال التالي حالة استخدام شائعة للروبوتات. يوضّح هذا المثال كيفية تمرير صورة وطلب نصي إلى النموذج باستخدام طريقة generateContent
للحصول على قائمة بالعناصر المحدّدة مع نقاطها الثنائية الأبعاد المقابلة.
يعرض النموذج نقاطًا للعناصر التي تم التعرّف عليها في صورة، ويعرض الإحداثيات الثنائية الأبعاد العادية والتصنيفات الخاصة بها.
يمكنك استخدام هذا الناتج مع واجهة برمجة تطبيقات خاصة بالروبوتات أو استدعاء نموذج رؤية ولغة وإجراء (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 ميزانية مرنة للتفكير تتيح لك التحكّم في المفاضلة بين وقت الاستجابة والدقة. بالنسبة إلى مهام الفهم المكاني، مثل رصد العناصر، يمكن للنموذج تحقيق أداء عالٍ بميزانية تفكير صغيرة. تستفيد مهام الاستدلال الأكثر تعقيدًا، مثل العد وتقدير الوزن، من ميزانية تفكير أكبر. يتيح لك ذلك تحقيق التوازن بين الحاجة إلى ردود منخفضة الاستجابة ونتائج عالية الدقة للمهام الأكثر صعوبة.
لمزيد من المعلومات عن ميزانيات التفكير، اطّلِع على صفحة الإمكانات الأساسية التفكير.
إمكانات بالذكاء الاصطناعي الوكيل للروبوتات
يشرح هذا القسم مختلف إمكانات Gemini Robotics-ER 1.5، ويوضّح كيفية استخدام النموذج في تطبيقات الإدراك الآلي والاستدلال والتخطيط.
توضّح الأمثلة الواردة في هذا القسم إمكانات تتراوح بين الإشارة إلى الكائنات والعثور عليها في صورة، وتخطيط المسارات، وتنظيم المهام الطويلة الأمد. لتبسيط الأمر، تم تقليل مقتطفات الرموز البرمجية لعرض الطلب
والاتصال بواجهة برمجة التطبيقات 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 [].
"""
تعرض النتيجة قلمًا وكمبيوترًا محمولاً يتم تتبّعهما في جميع لقطات الفيديو.
للاطّلاع على الرمز الكامل القابل للتنفيذ، راجِع كتاب وصفات الروبوتات.
رصد الأجسام والمربّعات المحيطة
بالإضافة إلى النقاط الفردية، يمكن للنموذج أيضًا عرض مربّعات حدود ثنائية الأبعاد، ما يوفّر منطقة مستطيلة تحيط بأحد العناصر.
يطلب هذا المثال مربّعات إحاطة ثنائية الأبعاد للعناصر القابلة للتحديد على طاولة. يتم توجيه النموذج إلى حصر الناتج على 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)
تعرض الصورة التالية المربّعات التي يعرضها النموذج.
للاطّلاع على الرمز الكامل القابل للتنفيذ، راجِع كتاب الطبخ الخاص بالروبوتات. تتضمّن صفحة فهم الصور أيضًا أمثلة إضافية على المهام المرئية، مثل تقسيم الصور ورصد العناصر.
يمكنك الاطّلاع على أمثلة إضافية لمربّعات الإحاطة في صفحة فهم الصور.
المسارات
يمكن لنموذج 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"}]
استدعاء واجهة برمجة تطبيقات مخصّصة لبرامج الروبوت
يوضّح هذا المثال تنسيق المهام باستخدام واجهة برمجة تطبيقات مخصّصة للروبوت. وتتضمّن واجهة برمجة تطبيقات وهمية مصمَّمة لتنفيذ عملية الالتقاط والوضع. المهمة هي التقاط مكعّب أزرق ووضعه في وعاء برتقالي:
على غرار الأمثلة الأخرى الواردة في هذه الصفحة، يتوفّر رمز التشغيل الكامل في كتاب وصفات الروبوتات.
الخطوة الأولى هي تحديد موقع كلتا السلعتَين باستخدام الطلب التالي:
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"}
]
يستخدم هذا المثال واجهة برمجة التطبيقات الوهمية التالية الخاصة بالروبوت:
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")
الخطوة التالية هي استدعاء سلسلة من دوال واجهة برمجة التطبيقات مع المنطق اللازم لتنفيذ الإجراء. يتضمّن الطلب التالي وصفًا لواجهة برمجة التطبيقات الخاصة بالروبوت التي يجب أن يستخدمها النموذج عند تنسيق هذه المهمة.
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.
"""
يوضّح ما يلي ناتجًا محتملاً للنموذج استنادًا إلى الطلب وواجهة برمجة التطبيقات الوهمية الخاصة بالروبوت. يتضمّن الناتج عملية التفكير في النموذج والمهام التي خطّط لها نتيجةً لذلك. ويعرض أيضًا ناتج استدعاءات دالة الروبوت التي رتّبها النموذج معًا.
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 بفعالية. يقدّم هذا القسم أفضل الممارسات والاستراتيجيات الأساسية لصياغة الطلبات والتعامل مع البيانات المرئية وتنظيم المهام لتحقيق النتائج الأكثر موثوقية.
استخدِم لغة واضحة وبسيطة.
استخدام اللغة الطبيعية: تم تصميم نموذج Gemini لفهم اللغة الطبيعية المستخدمة في المحادثات. نظِّم طلباتك بطريقة واضحة من الناحية الدلالية وتعكس الطريقة التي يقدّم بها الشخص التعليمات بشكل طبيعي.
استخدام مصطلحات شائعة: استخدِم لغة شائعة ومألوفة بدلاً من المصطلحات الفنية أو المتخصصة. إذا لم يستجب النموذج كما هو متوقّع لمصطلح معيّن، حاوِل إعادة صياغته باستخدام مرادف أكثر شيوعًا.
تحسين الإدخال المرئي
التكبير للحصول على التفاصيل: عند التعامل مع عناصر صغيرة أو يصعب تمييزها في لقطة أوسع، استخدِم وظيفة المربّع المحيط لعزل العنصر المطلوب. يمكنك بعد ذلك اقتصاص الصورة إلى هذا الجزء المحدّد وإرسال الصورة الجديدة التي تم التركيز فيها إلى النموذج لإجراء تحليل أكثر تفصيلاً.
تجربة الإضاءة والألوان: يمكن أن تتأثر قدرة النموذج على الإدراك بظروف الإضاءة الصعبة والتباين الضعيف في الألوان.
قسِّم المشاكل المعقّدة إلى خطوات أصغر. من خلال معالجة كل خطوة صغيرة على حدة، يمكنك توجيه النموذج نحو تحقيق نتيجة أكثر دقة ونجاحًا.
تحسين الدقة من خلال الإجماع بالنسبة إلى المهام التي تتطلّب درجة عالية من الدقة، يمكنك توجيه طلب إلى النموذج عدة مرات باستخدام الطلب نفسه. ومن خلال حساب متوسط النتائج التي تم عرضها، يمكنك التوصّل إلى "إجماع" يكون غالبًا أكثر دقة وموثوقية.
القيود
يجب مراعاة القيود التالية عند التطوير باستخدام Gemini Robotics-ER 1.5:
- حالة المعاينة: النموذج في المعاينة حاليًا. قد تتغيّر واجهات برمجة التطبيقات والإمكانات، وقد لا تكون مناسبة للتطبيقات التي تتطلّب إنتاجًا مهمًا بدون إجراء اختبارات شاملة.
- زمن الاستجابة: يمكن أن تؤدي الطلبات المعقّدة أو المدخلات العالية الدقة أو
thinking_budget
إلى زيادة أوقات المعالجة. - الهلوسات: مثل جميع النماذج اللغوية الكبيرة، يمكن أن يقدّم Gemini Robotics-ER 1.5 في بعض الأحيان "هلوسات" أو معلومات غير صحيحة، خاصةً عندما تكون الطلبات غامضة أو عندما تكون المدخلات خارج نطاق التوزيع.
- الاعتماد على جودة الطلب: تعتمد جودة النتائج التي يقدّمها النموذج بشكل كبير على وضوح الطلب المُدخَل ومدى صلته بالموضوع. يمكن أن تؤدي الطلبات الغامضة أو السيئة التنظيم إلى نتائج غير مثالية.
- تكلفة الحوسبة: يؤدي تشغيل النموذج، خاصةً مع إدخال فيديوهات أو
thinking_budget
عالية، إلى استهلاك موارد الحوسبة وتحمّل تكاليف. يمكنك الاطّلاع على صفحة التفكير لمزيد من التفاصيل. - أنواع الإدخال: اطّلِع على المواضيع التالية لمعرفة تفاصيل حول القيود المفروضة على كل وضع.
إشعار الخصوصية
أنت تقرّ بأنّ النماذج المشار إليها في هذا المستند ("نماذج الروبوتات") تستخدم بيانات الفيديو والصوت لتشغيل الأجهزة وتحريكها وفقًا لتعليماتك. وبالتالي، يمكنك تشغيل "نماذج الروبوتات" بطريقة تؤدي إلى جمع بيانات من أشخاص يمكن التعرّف عليهم، مثل بيانات الصوت والصور والتشابه ("البيانات الشخصية")، وذلك من خلال "نماذج الروبوتات". إذا اخترت تشغيل "نماذج الروبوتات" بطريقة تجمع "البيانات الشخصية"، أنت توافق على عدم السماح لأي أشخاص يمكن التعرّف عليهم بالتفاعل مع "نماذج الروبوتات" أو التواجد في المنطقة المحيطة بها، إلا بعد إبلاغ هؤلاء الأشخاص بشكل كافٍ بأنّه قد يتم تقديم بياناتهم الشخصية إلى Google واستخدامها من قِبلها على النحو الموضّح في "البنود الإضافية لخدمة Gemini API" المتوفّرة على https://ai.google.dev/gemini-api/terms (يُشار إليها باسم "البنود")، بما في ذلك وفقًا للقسم بعنوان "طريقة استخدام Google لبياناتك". ستضمن أنّ هذا الإشعار يسمح بجمع البيانات الشخصية واستخدامها على النحو الموضّح في "البنود"، وستبذل جهودًا معقولة تجاريًا للحدّ من جمع البيانات الشخصية وتوزيعها باستخدام تقنيات مثل تمويه الوجوه وتشغيل "نماذج الروبوتات" في مناطق لا تحتوي على أشخاص يمكن التعرّف عليهم إلى الحدّ الذي يمكن تنفيذه عمليًا.
الأسعار
للحصول على معلومات تفصيلية حول الأسعار والمناطق المتاحة، يُرجى الرجوع إلى صفحة الأسعار.
الخطوات التالية
- استكشِف الإمكانات الأخرى وواصِل تجربة طلبات ومدخلات مختلفة لاكتشاف المزيد من تطبيقات Gemini Robotics-ER 1.5. يمكنك الاطّلاع على كتاب وصفات الروبوتات للحصول على مزيد من الأمثلة.
- لمعرفة المزيد حول كيفية تصميم نماذج Gemini Robotics مع مراعاة الأمان، يمكنك الانتقال إلى صفحة أمان الروبوتات في Google DeepMind.
- يمكنك الاطّلاع على آخر الأخبار حول نماذج Gemini Robotics على صفحة Gemini Robotics المقصودة.