Remove elements that keep appearing despite saying 'no'
When "no people" or "no text" still leaves unwanted elements, describe the empty scene positively, then record and compare results with a small script.
You wrote "no people" or "without text on signs" in an image prompt, and pedestrians or lettering still show up. Google Cloud's guidance is to describe the scene state you want instead of negating what you do not want. This guide turns that into a prompt template and adds a script that compares results a person records. No images were generated. Techniques for maintaining consistent visual traits across generations are covered in maintain character consistency.
[1] Separate what the official guidance says. Google Cloud's Gemini image generation best practices recommends describing the state you want rather than negating (for example, "an empty, deserted street with no signs of traffic" instead of "no cars").
The separate negativePrompt field is a different matter. The negative prompt documentation describes it as a legacy Imagen feature and lists only three supporting models: imagen-3.0-generate-001, imagen-3.0-fast-generate-001, and imagen-3.0-capability-001. It says models from imagen-3.0-generate-002 on do not include it, and the same page announces the discontinuation of the Imagen endpoints and recommends migrating to gemini-2.5-flash-image. That page does not say whether Gemini image models accept negativePrompt. So the main method in this guide is positive description alone, and the field is an optional extra only for those three models.
[2] Set up a comparative prompt template. The target scene is a quiet rainy alley in front of a cafe where both pedestrians and sign lettering must be omitted.
Method A uses negative phrasing:
A scene in front of a cafe in a {scene}, no people, without text on signsMethod B describes the empty state positively:
A deserted cafe terrace on a narrow cobblestone alley at dawn in the rain, empty wooden benches and tables, puddles reflecting streetlights on wet pavement, blank rustic wooden signboard showing only natural wood grain texture[3] If you use one of the three Imagen 3 models above, list the items to exclude in negativePrompt as plain nouns. The request follows the instances / parameters structure in the documentation. This request was not run.
{ "instances": [ { "prompt": "A deserted cafe terrace on a narrow cobblestone alley at dawn in the rain, empty wooden benches and tables, puddles reflecting streetlights on wet pavement, blank rustic wooden signboard showing only natural wood grain texture" } ], "parameters": { "sampleCount": 4, "negativePrompt": "people, pedestrians, crowd, human silhouette, text, letters, words, font, watermark" }}[4] The file format for a person to record the result images, one line per image. The values below are made-up example values to show the script's input format, not observations from generated images.
prompt_id|sample_id|has_person|has_text|notesA|sample-1|Y|Y|example valueA|sample-2|N|Y|example valueA|sample-3|Y|N|example valueA|sample-4|N|N|example valueB|sample-1|N|N|example valueB|sample-2|N|N|example valueB|sample-3|N|N|example valueB|sample-4|Y|N|example valuehas_person and has_text are Y when a person or text is visible in the image. With 4 samples per prompt the rates are only a rough comparison; to compare for real, generate more images with identical settings and record them.
[5] A script that reads the record file, checks column count, allowed values (Y/N), and duplicate sample keys, and computes each prompt's clean rate. It does not read images; it only tallies the Y/N values a person wrote.
#!/usr/bin/env python3"""usage: check_eval.py <eval_file>"""import sys, os H = ["prompt_id", "sample_id", "has_person", "has_text", "notes"] def main(): if len(sys.argv) < 2 or not os.path.exists(sys.argv[1]): print("[ERROR] Missing or non-existent file"); sys.exit(2) lines = [l.strip() for l in open(sys.argv[1], encoding="utf-8") if l.strip()] if not lines or [c.strip() for c in lines[0].split("|")] != H: print("[ERROR] Invalid header"); sys.exit(1) seen, errors, c = set(), [], {"A": [0, 0, 0, 0], "B": [0, 0, 0, 0]} for n, l in enumerate(lines[1:], 2): row = [x.strip() for x in l.split("|")] if len(row) != 5: errors.append(f"Line {n}: col count {len(row)} != 5"); continue pid, sid, hp, ht, _ = row if pid not in ("A", "B"): errors.append(f"Line {n}: invalid prompt_id '{pid}'") if (pid, sid) in seen: errors.append(f"Line {n}: duplicate key ({pid}, {sid})") seen.add((pid, sid)) if hp not in ("Y", "N") or ht not in ("Y", "N"): errors.append(f"Line {n}: flags must be 'Y' or 'N'") if pid in c and hp in ("Y", "N") and ht in ("Y", "N"): c[pid][0] += 1 if hp == "Y": c[pid][1] += 1 if ht == "Y": c[pid][2] += 1 if hp == "N" and ht == "N": c[pid][3] += 1 if errors: for e in errors: print(f"[ERROR] {e}") print(f"Validation failed with {len(errors)} error(s)"); sys.exit(1) print("=== Evaluation Summary ===") print("Prompt | Total | Person Defect | Text Defect | Clean (Success)") print("-" * 65) for pid in ("A", "B"): tot, p_cnt, t_cnt, cln = c[pid] if tot == 0: continue p_r, t_r, c_r = (p_cnt / tot) * 100, (t_cnt / tot) * 100, (cln / tot) * 100 print(f"Prompt {pid}| {tot:<6}| {p_cnt} ({p_r:5.1f}%) | {t_cnt} ({t_r:5.1f}%) | {cln} ({c_r:5.1f}%)") print("-" * 65) if c["A"][0] == 0 or c["B"][0] == 0: print("[ERROR] Both prompts need at least one sample"); sys.exit(1) a_rate, b_rate = c["A"][3] / c["A"][0] * 100, c["B"][3] / c["B"][0] * 100 if b_rate > a_rate: print(f"[PASS] Prompt B clean rate ({b_rate:.1f}%) > Prompt A clean rate ({a_rate:.1f}%)") sys.exit(0) print(f"[FAIL] Prompt B clean rate ({b_rate:.1f}%) is not higher than Prompt A ({a_rate:.1f}%)") sys.exit(1) if __name__ == "__main__": main()[6] Run it on the example record file.
$ python3 check_eval.py eval.en.txt=== Evaluation Summary ===Prompt | Total | Person Defect | Text Defect | Clean (Success)-----------------------------------------------------------------Prompt A| 4 | 2 ( 50.0%) | 2 ( 50.0%) | 1 ( 25.0%)Prompt B| 4 | 1 ( 25.0%) | 0 ( 0.0%) | 3 ( 75.0%)-----------------------------------------------------------------[PASS] Prompt B clean rate (75.0%) > Prompt A clean rate (25.0%)The exit code is 0. To show the rates are computed from the input rather than hard-coded, the script was also run on eval-flat.en.txt, where B is not higher than A (example values).
$ python3 check_eval.py eval-flat.en.txt=== Evaluation Summary ===Prompt | Total | Person Defect | Text Defect | Clean (Success)-----------------------------------------------------------------Prompt A| 4 | 1 ( 25.0%) | 1 ( 25.0%) | 2 ( 50.0%)Prompt B| 4 | 1 ( 25.0%) | 1 ( 25.0%) | 2 ( 50.0%)-----------------------------------------------------------------[FAIL] Prompt B clean rate (50.0%) is not higher than Prompt A (50.0%)The exit code is 1. To check that malformed input is caught, eval-bad.en.txt has an invalid value (MAYBE) at line 4 and a duplicate sample key at line 6 (hand-made test data).
$ python3 check_eval.py eval-bad.en.txt[ERROR] Line 4: flags must be 'Y' or 'N'[ERROR] Line 6: duplicate key (A, sample-2)Validation failed with 2 error(s)Both anomalies are reported and the exit code is 1.
[7] These are check points chosen in advance, not results from generated images.
- To avoid text on signs: instead of the noun "sign" or "signboard", describe the surface directly, such as "plain unpainted dark steel panel" or "weathered wooden plank with visible grain".
- To avoid distant silhouettes: limit the time and visibility in the main prompt, for example "dense dawn fog at 4 AM". With a model that accepts
negativePrompt, nouns such asdistant figures, blurry silhouettesmay be added. - Do not use this template when you need legible typography such as storefronts or brand packaging; it leaves out the intended lettering too.