Skip to content

alaminkawsar/POC-table-masking

 
 

Repository files navigation

UI Element–Aware Data Masking (PoC)

Summary

This PoC demonstrates a UI-semantic–aware data masking system for UI screenshots. It detects UI elements using a YOLO model, extracts text using EasyOCR + Tesseract, and masks sensitive information based on user intent.

Supported masking:

  • Table Column → masks all values under a column name
  • Text Field → masks only the field value
  • Label Text → masks text appearing after a label

Detect UI → OCR → match user intent → mask only the required data


How It Works (High Level)

  1. YOLO detects UI elements (table column, text field, label)
  2. OCR extracts text inside detected regions
  3. User provides what to mask (column / field / label name)
  4. Matching text regions are masked on the image

How to Run

Install Dependencies

pip install -r requirements.txt

Run Demo

Download the model weights from the drive. And put it on the assets/ folder. Then run the pipeline

python main.py \
  --model assets/best.pt \
  --image src/images/ss-1.jpeg \
  --headers "Order Number" "Supplier Description" "Order Date"

Example Input

Example-1

For the input image below, if the user wants to mask the columns Line Number, Sold To Name, Description 1, and Secondary Quality, the output will be as shown.

Input Image: Input Image

Output Image (masked): Output Image


Example-2

For the input image below, if the user wants to mask the fields Order No/Type, Item Numer, Planned Effective, and Worker Order, the output will be as shown.
Input Image: Input Image Output Image (masked): Output Image


Train YOLO Model From CLI

To train the YOLO model, run the following command. Make sure to update the --data path to point to your dataset config file. To learn coco8 dataset format, check the coco8 dataset format file.

python train.py \
  --data config/coco8.yaml \
  --epochs 100 \
  --imgsz 640 \
  --batch 8

Tech Stack

  • YOLO (UI element detection)
  • EasyOCR + Tesseract (OCR)
  • OpenCV
  • Python

Note

This is a Proof of Concept, focused on demonstrating intent-based, UI-aware masking rather than full production coverage.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • Jupyter Notebook 91.3%
  • Python 8.7%