UNet4+: A Full-Scale and Densely-Connected UNet Architecture for Historical Document Image Binarization
The architectural evolution from UNet, UNet$^e$, UNet+, UNet++, UNet3+, and finally to our proposed UNet4+. Each node in all subgraphs represents a convolution block, with the number of output channels shown below. The solid downward and upward arrows denote downsampling and upsampling, respectively. The dashed arrows indicate skip connections, where the light blue ones represent conventional skip connections between feature maps of the same scale, while the purple (requiring downsampling) and brown (requiring upsampling) represent full-scale skip connections between feature maps of different scales. The bidirectional hollow arrows indicate deep supervision and the thick solid lines are mandatory.
This repository provides the official Keras implementation of UNet4+ in the following paper:
UNet4+: A Full-Scale and Densely-Connected UNet Architecture for Historical Document Image Binarization
Wei XIONG, Zhizhi XIANG, Song WANG
Submitted to Pattern Analysis and Applications, 09 August 2025 (draft) and 20 August 2026 (rev1)
Once the paper is accepted for publication, we will provide detailed instructions and release the pre-trained weight files.
Please stay tuned!
- GPU: NVIDIA A800-80GB PCIe (80GB)
- CPU: 14 vCPU Intel(R) Xeon(R) Gold 6348 CPU @ 2.60GHz
- MEM: 120GB
- Ubuntu: 20.04.6
- Driver: 590.48.01
- CUDA: 11.2.152
- cuDNN: 8.1.1
- Python: 3.8.10
- Keras: 2.9.0
- TensorFlow: 2.9.0
- OpenCV: 5.0.0
- Create an anaconda environment
$ conda create -n unet4plus python=3.8
$ conda activate unet4plus- Install Keras
$ conda install -c conda-forge keras=2.9 keras-flops tensorflow-gpuIf you encounter an error while executing the above command, try running the following command:
$ conda install -c conda-forge keras=2.9 tensorflow-gpu
$ pip install keras-flops tensorflow==2.9- Install other missing packages
$ pip install opencv-python opencv-contrib-python
$ pip install matplotlib tqdm scikit-image pandas split-folders$ python data_prepare.py
# Before executing ``train_pre_split.py'', make sure ``data_root'' directory exists.
$ python train_pre_split.py# Before executing ``test.py'', make sure ``model_weight'' file exists.
$ python test.py




