Auf dieser Seite wird beschrieben, wie Sie Filter für verantwortungsbewusste KI (Responsible AI, RAI) in Imagen auf Vertex AI festlegen.
Es gibt mehrere RAI-Filterparameter, die Sie mit Imagen in Vertex AI-Modellen verwenden können. Sie können das Modell beispielsweise RAI-Filtercodes für blockierte Inhalte melden lassen, die Erstellung von Personen oder Gesichtern mithilfe von RAI-Filtern deaktivieren, die Ebene der Inhaltsfilterung festlegen oder gerundete RAI-Bewertungen einer Liste mit Sicherheitattributen für Eingabe und Ausgabe zurückgeben lassen.
Die verfügbaren Einstellungen hängen von der verwendeten Imagen-Modellversion ab. Weitere Informationen finden Sie unter Imagen-Modelle und in der API-Referenz.
Klicken Sie auf Imagen. Die Seite zur Bildgenerierung von Imagen Media Studio wird angezeigt.
Passen Sie im Bereich Einstellungen die folgenden Optionen an:
Modell: Wählen Sie ein Modell aus den verfügbaren Optionen aus.
Weitere Informationen zu den verfügbaren Modellen finden Sie unter Imagen-Modelle.
Anzahl der Ergebnisse: Stellen Sie den Schieberegler ein oder geben Sie einen Wert zwischen 1 und 4 ein.
Konfigurieren Sie im Abschnitt Sicherheit die folgenden Einstellungen:
Wählen Sie eine der folgenden Einstellungen für Personen generieren aus:
Zulassen (nur Erwachsene): Es dürfen nur erwachsene Personen oder Gesichter generiert werden.
Es dürfen keine Bilder von Jugendlichen oder Kindern oder Gesichter von Jugendlichen oder Kindern generiert werden.
Zulassen (alle Altersgruppen): Es dürfen Personen oder Gesichter aller Altersgruppen generiert werden.
Nicht zulassen: Es werden keine Personen oder Gesichter generiert.
Wählen Sie eine der folgenden Einstellungen für den Schwellenwert für den Sicherheitsfilter aus:
Meiste blockieren: Die meisten schädlichen Inhalte werden blockiert.
Einige blockieren: Einige problematische Prompts und Antworten werden blockiert.
Wenige blockieren: Es werden nur sehr wenige problematische Prompts und Antworten blockiert.
Geben Sie im Feld Prompt schreiben Ihren Textprompt ein, der die zu generierenden Bilder beschreibt. Beispiel: Kleines Boot auf dem Wasser am Morgen, Wasserfarben, Illustration.
Klicken Sie auf sendErstellen.
REST
Ersetzen Sie diese Werte in den folgenden Anfragedaten:
LOCATION: Die Region Ihres Projekts. Beispiel: us-central1, europe-west2 oder asia-northeast3. Eine Liste der verfügbaren Regionen finden Sie unter Generative AI an Vertex AI-Standorten.
TEXT_PROMPT: Der Text-Prompt, der bestimmt, welche Bilder das Modell generiert. Dieses Feld ist sowohl zum Erstellen als auch zum Bearbeiten erforderlich.
IMAGE_COUNT ist die Anzahl der generierten Bilder.
Zulässige Ganzzahlwerte: 1–8 (imagegeneration@002), 1–4 (alle anderen Modellversionen).
Standardwert: 4
SAFETY_SETTING: String. Optional. Eine Einstellung, mit der die Grenzwerte für Sicherheitsfilter für generierte Bilder gesteuert werden. Verfügbare Werte:
block_low_and_above: Der höchste Sicherheitsgrenzwert, der dazu führt, dass die meisten generierten Bilder gefiltert werden. Vorheriger Wert: block_most.
block_medium_and_above (Standardeinstellung): Ein mittlerer Sicherheitsgrenzwert, der potenziell schädliche und sichere Inhalte ausgeglichen behandelt. Vorheriger Wert: block_some.
block_only_high: Ein Sicherheitsgrenzwert, der die Anzahl der Anfragen reduziert, die aufgrund von Sicherheitsfiltern blockiert werden. Diese Einstellung kann dazu führen, dass Imagen mehr anstößige Inhalte generiert. Vorheriger Wert: block_few.
PERSON_SETTING: String. Optional. Die Sicherheitseinstellung, die bestimmt, welche Art von Personen- oder Gesichtererstellung das Modell zulässt. Verfügbare Werte:
allow_adult (Standard): Es dürfen nur Erwachsene generiert werden, mit Ausnahme von Prominenten. Die Generierung von Prominenten ist in keiner Einstellung zulässig.
dont_allow: Personen oder Gesichter in generierten Bildern nicht zulassen.
INCLUDE_SAFETY_ATTRIBUTES: boolesch. Optional. Gibt an, ob gerundete Werte der verantwortungsbewussten KI für eine Liste von Sicherheitsattributen in Antworten für ungefilterte Eingabe und Ausgabe aktiviert werden sollen. Kategorien für Sicherheitsattribute: "Death, Harm & Tragedy", "Firearms & Weapons", "Hate", "Health", "Illicit Drugs", "Politics", "Porn", "Religion & Belief","Toxic", "Violence", "Vulgarity", "War & Conflict". Standardwert: false.
HTTP-Methode und URL:
POST https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/publishers/google/models/imagegeneration@006:predict
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-09-04 (UTC)."],[],[],null,["| **Caution:** Starting on June 24, 2025, Imagen versions 1 and 2 are deprecated. Imagen models `imagegeneration@002`, `imagegeneration@005`, and `imagegeneration@006` will be removed on September 24, 2025 . For more information about migrating to Imagen 3, see [Migrate to\n| Imagen 3](/vertex-ai/generative-ai/docs/image/migrate-to-imagen-3).\n\n\u003cbr /\u003e\n\n\n[Try image generation (Vertex AI Studio)](https://console.cloud.google.com/vertex-ai/studio/media/generate;tab=image)\n\n[Try Imagen in a Colab](https://colab.research.google.com/github/GoogleCloudPlatform/generative-ai/blob/main/vision/getting-started/imagen4_image_generation.ipynb)\n\nThis page describes how to set Responsible AI (RAI) filters in\nImagen on Vertex AI.\n\nThere are several RAI filtering parameters that you can use with\nImagen on Vertex AI models. For example, you can let the model report RAI filter\ncodes for blocked content, disable people or face generation using RAI filters,\nset the level of content filtering, or return rounded RAI scores of list of\nsafety attributes for input and output.\n\nThe available settings depend on the Imagen model version that\nyou use. For more information, see [Imagen\nmodels](/vertex-ai/generative-ai/docs/models#imagen-models) and the [API\nreference](/vertex-ai/generative-ai/docs/model-reference/image-generation).\n\nFor more information about RAI, see [Responsible AI and usage guidelines for\nImagen](/vertex-ai/generative-ai/docs/image/responsible-ai-imagen).\n\nSet RAI parameters\n\nDo the following: \n\nConsole\n\n1. In the Google Cloud console, go to the **Vertex AI \\\u003e Media\n Studio** page.\n\n [Go to Media\n Studio](https://console.cloud.google.com/vertex-ai/studio/media/generate;tab=image)\n2. Click **Imagen**. The Imagen Media Studio image generation page is\n displayed.\n\n3. In the **Settings** panel, adjust the following options:\n\n - **Model**: Choose a model from the available options.\n\n For more information about available models, see [Imagen\n models](/vertex-ai/generative-ai/docs/models#imagen-models)\n - **Number of results** : Adjust the slider or enter a value between\n **1** and **4**.\n\n4. In the **Safety** section configure the following settings:\n\n - Select one of the following **Person generation** settings:\n\n - **Allow (Adults only)**: Generate adult people or faces only. Don't generate youth or children people or faces.\n - **Allow (All ages)**: Generate people or faces of all ages.\n - **Don't allow**: Don't generate people or faces.\n - Select one of the following **Safety filter threshold** settings:\n\n - **Block most**: Blocks the most of the harmful content.\n - **Block some**: Blocks some problematic prompts and responses.\n - **Block few**: Blocks very few problematic prompts and responses.\n5. In the **Write your prompt** box, enter your text prompt that describes\n the images to generate. For example, **small boat on water in the morning\n watercolor illustration**.\n\n6. Click send **Generate**.\n\nREST\n\n\nBefore using any of the request data,\nmake the following replacements:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: Your Google Cloud [project ID](/resource-manager/docs/creating-managing-projects#identifiers).\n- \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e: Your project's region. For example, `us-central1`, `europe-west2`, or `asia-northeast3`. For a list of available regions, see [Generative AI on Vertex AI locations](/vertex-ai/generative-ai/docs/learn/locations-genai).\n- \u003cvar translate=\"no\"\u003eTEXT_PROMPT\u003c/var\u003e: The text prompt that guides what images the model generates. This field is required for both generation and editing.\n- \u003cvar translate=\"no\"\u003eIMAGE_COUNT\u003c/var\u003e: The number of generated images. Accepted integer values: 1-8 (`imagegeneration@002`), 1-4 (all other model versions). Default value: 4.\n- \u003cvar translate=\"no\"\u003eSAFETY_SETTING\u003c/var\u003e: string. Optional. A setting that controls safety filter thresholds for generated images. Available values:\n - `block_low_and_above`: The highest safety threshold, resulting in the largest amount of generated images that are filtered. Previous value: `block_most`.\n - `block_medium_and_above` (default): A medium safety threshold that balances filtering for potentially harmful and safe content. Previous value: `block_some`.\n - `block_only_high`: A safety threshold that reduces the number of requests blocked due to safety filters. This setting might increase objectionable content generated by Imagen. Previous value: `block_few`.\n- \u003cvar translate=\"no\"\u003ePERSON_SETTING\u003c/var\u003e: string. Optional. The safety setting that controls the type of people or face generation the model allows. Available values:\n - `allow_adult` (default): Allow generation of adults only, except for celebrity generation. Celebrity generation is not allowed for any setting.\n - `dont_allow`: Disable the inclusion of people or faces in generated images.\n- \u003cvar translate=\"no\"\u003eINCLUDE_RAI_REASON\u003c/var\u003e: boolean. Optional. Whether to enable the [Responsible AI filtered reason\n code](/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#safety-categories) in responses with blocked input or output. Default value: `true`.\n- \u003cvar translate=\"no\"\u003eINCLUDE_SAFETY_ATTRIBUTES\u003c/var\u003e: boolean. Optional. Whether to enable rounded Responsible AI scores for a list of safety attributes in responses for unfiltered input and output. Safety attribute categories: `\"Death, Harm & Tragedy\"`, `\"Firearms & Weapons\"`, `\"Hate\"`, `\"Health\"`, `\"Illicit Drugs\"`, `\"Politics\"`, `\"Porn\"`, `\"Religion & Belief\"`, `\"Toxic\"`, `\"Violence\"`, `\"Vulgarity\"`, `\"War & Conflict\"`. Default value: `false`.\n\n\nHTTP method and URL:\n\n```\nPOST https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/publishers/google/models/imagegeneration@006:predict\n```\n\n\nRequest JSON body:\n\n```\n{\n \"instances\": [\n {\n \"prompt\": \"TEXT_PROMPT\"\n }\n ],\n \"parameters\": {\n \"sampleCount\": IMAGE_COUNT,\n \"safetySetting\": \"\u003cvar translate=\"no\"\u003eSAFETY_SETTING\u003c/var\u003e\",\n \"personGeneration\": \"\u003cvar translate=\"no\"\u003ePERSON_SETTING\u003c/var\u003e\",\n \"includeRaiReason\": \u003cvar translate=\"no\"\u003eINCLUDE_RAI_REASON\u003c/var\u003e,\n \"includeSafetyAttributes\": \u003cvar translate=\"no\"\u003eINCLUDE_SAFETY_ATTRIBUTES\u003c/var\u003e\n }\n}\n```\n\nTo send your request, choose one of these options: \n\ncurl **Note:** The following command assumes that you have logged in to the `gcloud` CLI with your user account by running [`gcloud init`](/sdk/gcloud/reference/init) or [`gcloud auth login`](/sdk/gcloud/reference/auth/login) , or by using [Cloud Shell](/shell/docs), which automatically logs you into the `gcloud` CLI . You can check the currently active account by running [`gcloud auth list`](/sdk/gcloud/reference/auth/list).\n\n\nSave the request body in a file named `request.json`,\nand execute the following command:\n\n```\ncurl -X POST \\\n -H \"Authorization: Bearer $(gcloud auth print-access-token)\" \\\n -H \"Content-Type: application/json; charset=utf-8\" \\\n -d @request.json \\\n \"https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/publishers/google/models/imagegeneration@006:predict\"\n```\n\nPowerShell **Note:** The following command assumes that you have logged in to the `gcloud` CLI with your user account by running [`gcloud init`](/sdk/gcloud/reference/init) or [`gcloud auth login`](/sdk/gcloud/reference/auth/login) . You can check the currently active account by running [`gcloud auth list`](/sdk/gcloud/reference/auth/list).\n\n\nSave the request body in a file named `request.json`,\nand execute the following command:\n\n```\n$cred = gcloud auth print-access-token\n$headers = @{ \"Authorization\" = \"Bearer $cred\" }\n\nInvoke-WebRequest `\n -Method POST `\n -Headers $headers `\n -ContentType: \"application/json; charset=utf-8\" `\n -InFile request.json `\n -Uri \"https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/publishers/google/models/imagegeneration@006:predict\" | Select-Object -Expand Content\n```\nThe response you get depends on the safety settings you set. For more information, see [Understand and configure\nResponsible AI (RAI) for Imagen](/vertex-ai/generative-ai/docs/image/responsible-ai-imagen).\n\n\u003cbr /\u003e\n\nWhat's next\n\n- [Responsible AI and usage guidelines for\n Imagen](/vertex-ai/generative-ai/docs/image/responsible-ai-imagen)\n\n- [Verify an image\n watermark](/vertex-ai/generative-ai/docs/image/verify-watermark)"]]