Downloads · 30 days
0
ordaktaktak/Document-Scanner
Document-Scanner is a machine learning model from ordaktaktak. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
U-Net Like Pretrained Model For Scene Document Detection (pytorch, Semantic Segmentation)
Downloads · 30 days
0
Access
Public
Updated Mar 5, 2024
Repo size
122 MB
Likes
7
Public
Click a slice to open those files.
.pth122 MB · 100%
From the Hugging Face model README
U-Net Like Pretrained Model For Scene Document Detection (pytorch, Semantic Segmentation)
$ pip install -r requirements.txtStructure/ scanner = Scanner("Structure/Scanner-Detector.pth", config_)
Load model.
org = cv2.imread(fname)
org_gray = cv2.cvtColor(org, cv2.COLOR_RGB2GRAY)
org_resize = cv2.resize(org_gray, (256, 256), interpolation = cv2.INTER_AREA)
Read image in gray scale and resize it to 256*256.
mask = scanner.ScanView(org_resize)
Detect document area.
paper, approx = ExtractPaper(org_gray, mask)
org = DrawBox(org, approx)
Extract document and draw bounding box on original image.
paper = EnhacePaper(paper)
Enhance extracted document.