Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Imagen 3 filter sensitivity

I'm building an app using Imagen 3, and getting a lot of images blocked or filtered out because of safety filters, even though the subject/prompt is very typical.

for example this request:
{
"instances": [
{
"prompt": "Close up on John Smith's determined face. He has short brown hair and a sharp suit."
}
],
"parameters": {
"sampleCount": 1,
"safetySetting": "block_only_high",
"aspectRatio": "16:9",
"includeRaiReason": true,
"person_generation": "allow_adult"
}
}


Returned this error:
Error: Unable to show generated images. All images were filtered out because they violated Vertex AI's usage guidelines. You will not be charged for blocked images. Try rephrasing the prompt. If you think this was an error, send feedback. Support codes: 29310472

Is there any recommendation on how to get around this?

1 3 2,312
3 REPLIES 3

Hi @mkcoder,

Welcome to Google Cloud Community!

It looks like you're encountering an issue with the safety filters in Imagen 3. These filters are designed to prevent the generation of harmful or explicit content. However, they can sometimes block seemingly harmless requests due to specific keywords or context. 

While they are generally effective, they can occasionally be overly restrictive, especially when dealing with prompts that are borderline or ambiguous. Here are some strategies you can try to troubleshoot and potentially resolve this issue:

1. Simplify the Prompt: Sometimes, even small changes in phrasing can trigger safety filters. You can try to simplify or rephrase the prompt to make it sound more neutral. Removing specific names like "John Smith" could help avoid potential false positives, as the model may associate the name with known individuals, which can trigger safety filters.

  • Avoid Suggestive Language: Use neutral and descriptive language to avoid triggering the filters.
  • Focus on the Visual Elements: Emphasize the specific details you want in the image, such as lighting, color palette, and composition.
  • Be Specific: The more precise your prompt, the better the AI can understand your intent and generate appropriate images.

2. Experiment with Different Safety Settings:

  • Lower the Safety Setting: If you're confident that your prompt is safe, try lowering the safetySetting parameter. However, use caution, as this can increase the risk of generating harmful content.

3. Avoid Ambiguous Terms: Some terms or phrases can be interpreted by the safety filters as inappropriate even if the context doesn't suggest anything harmful. Words like "determined" or "sharp suit" might trigger filter flags depending on context.

4. Check Safety Settings: The setting "safetySetting": "block_only_high" is designed to allow the majority of images to pass but block those with high safety risks. You might want to try a more relaxed safety setting or even experiment with setting it to "none" if you're not concerned about any potential false positives. However, be cautious with this setting, as it may allow more questionable content to be generated.

5. Understanding Imagen's Limitations: Imagen, like all large language models, has biases in its training data. Even seemingly benign prompts can lead to unexpected results due to these biases. The model might associate certain facial expressions or clothing styles with concepts that trigger its safety filters, regardless of your intent.

Remember:

  • Imagen Usage Guidelines: Consider following general product attributes and legal considerations before you use Imagen on Vertex AI.
  • Respectful Content: Always use Imagen 3 responsibly and avoid generating harmful or offensive content. Consider applying these recommended practices.
  • Iterative Process: Experiment with different prompts and settings to find the best approach for your specific needs.

I hope the above information is helpful.

 

 

 

I have the same problem, these filters make the model unusable for most apps and customer facing webservices; people will rewrite a prompt at most once. I'm using imagen-3.0-generate-001 

"personGeneration" => "allow_adult"
"safetySetting" => "block_only_high"

 

prompt: dog walking in a sunny park - WORKED

prompt: adult man in jogging suite walking dog in a sunny park - FAILED

error:

Image generation failed with the following error: The prompt could not be submitted. Setting personGeneration value in the safety settings to allow generating images containing people is currently an allowlist-only feature. Please check your current safety settings for personGeneration or contact your Google representative to request allowlisting.

I have the same issue. It seems imagen is no longer allowed to generate any person. Incredibly basic, harmless prompts now result in an error for me.

I was previously on the allowlist and has set "personGeneration": "allow_adult". Now all my api calls fail with the same error: "Setting personGeneration value in the safety settings to allow generating images containing people is currently an allowlist-only feature"

I had been using this setting for weeks with no issue. Maybe when imagen opened to general availability, this allowlist got reset or something.