Document Image Generation
Module: Generative AI | Difficulty: Advanced
Document Layout Generation
Text Rendering Pipeline
- Generate layout
- Render text with font/style
- Apply document degradation
Synthetic OCR Training Data
class DocumentGenerator(nn.Module):
def __init__(self, layout_net, text_renderer, degradation):
super().__init__()
self.layout = layout_net
self.text = text_renderer
self.degrade = degradation
def forward(self, text_list, style):
layout = self.layout(len(text_list), style)
clean = self.text(text_list, layout)
return self.degrade(clean)
Research Insight: Synthetic document images improve OCR accuracy by 15-25% on out-of-domain documents. The key is to model realistic degradations: blur, noise, skew, and background variation.