View on GitHub

smart_ui

App that generates a JSON file containing the details of various UI components from the screenshot of a wireframe. [Submission for Smart UI (Techfest 2020-21)]

Text & Attribute Extractor

For each of the components detected by the UI Element Detector, text and other attributes are extracted based on its class assigned by the chosen deep learning model. These attributes contain font and color related properties.

Text Recognition using OCR

OCR techniques are applied on the text and image classified components. Text recognition is performed using tesserocr and keras-ocr.

tesserocr works best when there is a (very) clean segmentation of the foreground text from the background. For other cases, keras-ocr is used in conjunction with tesserocr to improve text recognition.


Attribute Extraction

For every class predicted by the deep learning model, following attributes are extracted:

Colors

Color pallette is extracted using the getcolors() method in the Pillow library. The color attributes are of two types -

PyTessBaseAPI exposes several tesseract API methods which are used to extract the font-related properties of the tesserocr-recognised text. Following is a description of the font properties that are extracted -