概述
可讀字體的出現得益於更大型的語言模型文字編碼器、字符感知編碼器、以文字為焦點的訓練資料以及新架構。這對任何製作海報、標誌、迷因或包裝樣稿的人都很重要。
深入探討
Writing is an unforgiving target. A face can be slightly off and still read as a face, but one wrong stroke turns an 'e' into a 'c'. Early diffusion models learned that shop signs, book covers and T-shirts contain lettering, so they produced shapes with the rhythm of text while getting the actual letters wrong. The text encoder was a major cause. Stable Diffusion 1.x used OpenAI's CLIP text encoder, which was trained to match whole captions to images. CLIP splits words into subword tokens, so a word like 'bakery' may become a single token, and the image model receives a representation of meaning rather than a sequence of letters. Nothing in that signal says 'b, then a, then k'. Google's Imagen research in 2022 found that a large frozen T5 language-model encoder improved prompt following, and its samples rendered text noticeably better. A follow-up Google study on character-aware models showed that byte-level encoders such as ByT5, which see individual characters, spell much better. Resolution mattered too. Small letters occupy very few cells in a compressed latent, so fine strokes blur. Training data was another limit. Captions rarely wrote out the text visible in an image, so the model could not link words to letter shapes. Progress came from several directions. DeepFloyd IF and Stable Diffusion 3 paired their image models with T5 encoders. Research systems such as TextDiffuser and GlyphControl gave the model explicit layouts or pre-rendered letter images to follow. Products including Ideogram, DALL-E 3 and later autoregressive image generators made legible text routine, helped by training captions that include the words shown in the image. One misconception is that modern models read letters from a font file. They still generate letters as pixels, which is why long passages, rare words and small print still go wrong.
現實世界的實施
一個早期的 Stable Diffusion 提示「Fresh Bread」的麵包店招牌會產生類似字母的雜亂線條,例如「FRESSH BRAED」,因為模型知道招牌包含文字,但不知道如何拼寫。
一位使用更新模型的行銷人員將海報標題縮短為三個簡短詞,並用引號包住,結果在前幾次嘗試中就能正確拼寫。
設計師先產生沒有文字的插圖,然後在排版程式中加入真實字體,確保字體、間距與拼寫完全正確。
使用者在生成的店面圖像中修正一個錯別字,方法是遮罩該區域並用正確單詞進行修復。
AI 生成圖像中文本渲染的未來
領先模型現在能可靠處理短標題和招牌,較難的問題已轉移到較長段落、多語言腳本、系列中一致的字體以及影片中的準確文字。擁有數千字符的腳本(如中文)或複雜字母連結的腳本(如阿拉伯語)歷來落後於英語,進展取決於該語言的訓練資料。可讀的生成文字也帶來濫用風險,因為逼真的假文件、收據和截圖更易製作。這使得水印和來源標示變得更重要。
付諸實踐
為什麼這很重要
- 速度與規模. 視覺人工智慧可以大規模自動化檢查、檢測和標記任務。
- 配裝選擇. 創意團隊可以透過更少的手動修改來更快地建立概念原型。
- 團隊與工作流程. 操作可以使用以前難以處理的影像和視訊訊號。
留意
- 如果出處不明,肖像權和同意可能會成為法律風險。
- 模型表現可能因光照、人口統計和環境的不同而有所不同。
- 除非監控置信閾值,否則誤報可能會被忽略。
後續步驟
- 定義精確度、召回率和錯誤成本的接受標準。
- 使用符合實際生產條件的數據進行測試。
- 為低置信度或高影響力的預測添加人工審核。
- 追蹤模型漂移並在相機或資料集變更後重新驗證。
不斷探索
常見問題
什麼是 AI 生成圖像中文本渲染?
AI 圖像生成器曾因其文字編碼器(如 CLIP)將提示轉換為捕捉整體意義但不逐字拼寫的子詞標記,導致產生混亂文字,因而無法準確辨識字母形狀。可讀字體的出現得益於更大型的語言模型文字編碼器、字符感知編碼器、以文字為焦點的訓練資料以及新架構。這對任何製作海報、標誌、迷因或包裝樣稿的人都很重要。
為什麼基於 CLIP 的圖像模型難以正確拼寫單字?
像“bakery”這樣的詞可以成為一個標記,因此圖像模型獲得了它的含義,但沒有關於其各個字母的資訊。
Google 的字元感知研究發現哪種編碼器拼字更好?
位元組級編碼器公開每個字符,為圖像模型提供子字標記隱藏的逐字母資訊。
為什麼生成的臉部可以容忍小錯誤,但生成的文字卻不能容忍?
字母是由精確的形狀定義的,因此一個微小的變化,例如將“e”變成“c”,就會破壞單字。
訓練資料的哪些限制導致很難將單字與字母形狀連結起來?
如果標題從未說明標誌的含義,則模型無法將這些單字與它看到的字母聯繫起來。
TextDiffuser 和 GlyphControl 等研究系統為影像生成添加了什麼?
他們提供了關於每個角色的去向和外觀的空間指導,模型在生成時遵循該指導。