An increasing number of institutions are moving from traditional to online digital verification of user documents, which in Sri Lanka requires clean digital images of documents such as the National Identity Card (NIC) and driving licence. These images are usually taken on smartphones, so they contain cluttered surroundings, and uneven natural light combined with laminated, reflective surfaces produces cast shadows that hinder binarisation and text recognition. An experiment with the Google Cloud Vision OCR API showed that it recognised on average 56.3 words on shadow-free images but only 45.9 words on the same images with shadows. NIC images are also unusual: they share dark-text-on-light-background properties with documents but carry background textures like natural images, so existing document shadow removal methods, which assume plain backgrounds, fail on them.
The project addresses this with a two-stage pipeline. First, the NIC region is cropped from the photograph using a U2-Net salient object detection model, selected after evaluating edge, frame, corner and region-based detection and YOLOv3. Second, shadows are removed with a model built on the Dual Hierarchical Aggregation Network (DHAN) followed by a Spatial Pooling Pyramid, producing a shadow-free image and a shadow mask. During training, the shadow-free output and the ground truth are passed through a pre-trained VGG-19 network and the difference between their feature maps forms a perception loss that teaches the generator to preserve background textures, while VGG-19 is not needed at inference time.
Because sensitive NIC images could only be collected in small numbers, synthetic shadow images were created by fusing shadow-free NIC images with SRD shadow masks using SM-GAN; models were trained on the public ISTD dataset and tested on the NIC dataset. Against a ground-truth reference of PSNR 23.24 and SSIM 0.93, the proposed model achieved PSNR 20.90 and SSIM 0.89, the lowest deviation from ground truth of all methods (10.1% in PSNR and 4.7% in SSIM). This outperformed the document-oriented BEDSR-Net (PSNR 14.56, SSIM 0.82), ST-CGAN (PSNR 19.08, SSIM 0.86) and vanilla DHAN (PSNR 18.20, SSIM 0.88), corresponding to improvements of about 12% in PSNR and 1% in SSIM over DHAN, while the maximum achievable output resolution rose by 63% from 315 x 420 to 402 x 536 on the same hardware. In context preservation tests on 37 images with Google Cloud Vision, the model recognised 24.8 words per image, slightly below vanilla DHAN (25.6). For cropping, U2-Net outperformed YOLOv3 with SSIM 0.9383 versus 0.8786 and FSIM 0.3447 versus 0.3109.
Texture-Preserving Shadow Removal Model
A modified DHAN architecture trained with a VGG-19 perception loss that removes hard shadows from reflective, textured documents while preserving background textures, without requiring the object classifier at inference time.
U2-Net-Based Document Cropping
The first application of U2-Net salient object detection to removing cluttered border regions from laminated document images, outperforming YOLOv3 on the NIC dataset.
Benchmark on a Novel Document Domain
A comparative evaluation of document and natural-image shadow removal methods (BEDSR-Net, ST-CGAN, DHAN) on synthetic NIC data, showing that this domain favours natural-image shadow removal approaches.
The architecture can be used directly or added to existing image processing pipelines as a pre-processor for online document verification and OCR, wherever text must be recognised from documents with reflective surfaces. By removing the need for the object classifier at runtime, it delivers higher-quality, higher-resolution outputs without taxing hardware, making it practical for real-world e-governance and corporate onboarding systems.
Project poster: Shadow Removal for Documents with Reflective, Textured Surface
Network structure: Dual Hierarchical Aggregation Network (DHAN) with Spatial Pooling Pyramid
Ahrooran Ravindran
Undergraduate Researcher
Proposed the new shadow removal architecture, conducted the DHAN experiments and wrote the PSNR and SSIM evaluation scripts.
Uthayamalini Arudselvam
Undergraduate Researcher
Conducted the BEDSR-Net and ST-CGAN shadow removal experiments and the context preservation evaluation across all models.
Abirame Sugirthalingam
Undergraduate Researcher
Led the document cropping research, including the comparison of YOLOv3 and U2-Net and their evaluation with FSIM and SSIM.