How abhistacodes/document-image-segmentation works
This repository implements document-image segmentation and downstream layout-feature analysis. The documented workflow pairs PRImA images with PAGE XML, creates masks, trains and evaluates an 11-class U-Net, then extracts class-specific bottleneck vectors for prototype and visualization analysis. The sampled code confirms the U-Net, masked feature pooling, analysis helpers, plotting helpers, and shared imports. Training, dataset preparation, metrics, and persistence are documented but their implementation was not present in the sampled source; their links are therefore limited to README evidence.
Main entry points: uNet_Model.py U-Net · imports.py Shared Imports · features.py Class Feature Extraction · plots.py Feature Visualization
Components 13
Segmentation
- XML Mask Preparation
- Training Pipeline
- U-Net
uNet_Model.py - Segmentation Evaluation
- Prediction Export
Feature Analysis
- Class Feature Extraction
features.py - Feature Vectors
- Class Prototypes
- Feature Visualization
plots.py - Similarity Analysis
features_analysis.py
Shared Utilities
- Shared Imports
imports.py
Other components
- PRImA Dataset
- PAGE XML
Connections 15
- PRImA Dataset → XML Mask Preparation: supplies images
README.md - PAGE XML → XML Mask Preparation: supplies annotations
README.md - XML Mask Preparation → Training Pipeline: provides masks
README.md - Training Pipeline → U-Net: trains
README.md - U-Net → Segmentation Evaluation: produces logits
README.md - Segmentation Evaluation → Prediction Export: exports masks
README.md - U-Net → Class Feature Extraction: returns bottleneck
features.py - Class Feature Extraction → Feature Vectors: pools features
README.md - Feature Vectors → Class Prototypes: averages by class
README.md - Feature Vectors → Feature Visualization: visualizes
README.md - Feature Vectors → Similarity Analysis: analyzes similarity
- Class Feature Extraction → Shared Imports: imports
features.py - U-Net → Shared Imports: imports
uNet_Model.py - Feature Visualization → Shared Imports: imports
plots.py - Similarity Analysis → Shared Imports: imports
features_analysis.py