mirror of
https://github.com/leigest519/ScreenCoder.git
synced 2026-02-13 02:02:48 +00:00
Initial commit
This commit is contained in:
45
UIED/config/CONFIG.py
Normal file
45
UIED/config/CONFIG.py
Normal file
@@ -0,0 +1,45 @@
|
||||
from os.path import join as pjoin
|
||||
import os
|
||||
|
||||
|
||||
class Config:
|
||||
|
||||
def __init__(self):
|
||||
# setting CNN (graphic elements) model
|
||||
self.image_shape = (64, 64, 3)
|
||||
# self.MODEL_PATH = 'E:\\Mulong\\Model\\UI2CODE\\cnn6_icon.h5'
|
||||
# self.class_map = ['button', 'input', 'icon', 'img', 'text']
|
||||
self.CNN_PATH = 'E:/Mulong/Model/rico_compos/cnn-rico-1.h5'
|
||||
self.element_class = ['Button', 'CheckBox', 'Chronometer', 'EditText', 'ImageButton', 'ImageView',
|
||||
'ProgressBar', 'RadioButton', 'RatingBar', 'SeekBar', 'Spinner', 'Switch',
|
||||
'ToggleButton', 'VideoView', 'TextView']
|
||||
self.class_number = len(self.element_class)
|
||||
|
||||
# setting EAST (ocr) model
|
||||
self.EAST_PATH = 'E:/Mulong/Model/East/east_icdar2015_resnet_v1_50_rbox'
|
||||
|
||||
self.COLOR = {'Button': (0, 255, 0), 'CheckBox': (0, 0, 255), 'Chronometer': (255, 166, 166),
|
||||
'EditText': (255, 166, 0),
|
||||
'ImageButton': (77, 77, 255), 'ImageView': (255, 0, 166), 'ProgressBar': (166, 0, 255),
|
||||
'RadioButton': (166, 166, 166),
|
||||
'RatingBar': (0, 166, 255), 'SeekBar': (0, 166, 10), 'Spinner': (50, 21, 255),
|
||||
'Switch': (80, 166, 66), 'ToggleButton': (0, 66, 80), 'VideoView': (88, 66, 0),
|
||||
'TextView': (169, 255, 0), 'NonText': (0,0,255),
|
||||
'Compo':(0, 0, 255), 'Text':(169, 255, 0), 'Block':(80, 166, 66)}
|
||||
|
||||
def build_output_folders(self):
|
||||
# setting data flow paths
|
||||
self.ROOT_INPUT = "E:\\Mulong\\Datasets\\rico\\combined"
|
||||
self.ROOT_OUTPUT = "E:\\Mulong\\Result\\rico\\rico_uied\\rico_new_uied_v3"
|
||||
|
||||
self.ROOT_IMG_ORG = pjoin(self.ROOT_INPUT, "org")
|
||||
self.ROOT_IP = pjoin(self.ROOT_OUTPUT, "ip")
|
||||
self.ROOT_OCR = pjoin(self.ROOT_OUTPUT, "ocr")
|
||||
self.ROOT_MERGE = pjoin(self.ROOT_OUTPUT, "merge")
|
||||
self.ROOT_IMG_COMPONENT = pjoin(self.ROOT_OUTPUT, "components")
|
||||
if not os.path.exists(self.ROOT_IP):
|
||||
os.mkdir(self.ROOT_IP)
|
||||
if not os.path.exists(self.ROOT_OCR):
|
||||
os.mkdir(self.ROOT_OCR)
|
||||
if not os.path.exists(self.ROOT_MERGE):
|
||||
os.mkdir(self.ROOT_MERGE)
|
||||
49
UIED/config/CONFIG_UIED.py
Normal file
49
UIED/config/CONFIG_UIED.py
Normal file
@@ -0,0 +1,49 @@
|
||||
class Config:
|
||||
|
||||
def __init__(self):
|
||||
# Adjustable
|
||||
# self.THRESHOLD_PRE_GRADIENT = 4 # dribbble:4 rico:4 web:1
|
||||
# self.THRESHOLD_OBJ_MIN_AREA = 55 # bottom line 55 of small circle
|
||||
# self.THRESHOLD_BLOCK_GRADIENT = 5
|
||||
|
||||
# *** Frozen ***
|
||||
self.THRESHOLD_REC_MIN_EVENNESS = 0.7
|
||||
self.THRESHOLD_REC_MAX_DENT_RATIO = 0.25
|
||||
self.THRESHOLD_LINE_THICKNESS = 8
|
||||
self.THRESHOLD_LINE_MIN_LENGTH = 0.95
|
||||
self.THRESHOLD_COMPO_MAX_SCALE = (0.25, 0.98) # (120/800, 422.5/450) maximum height and width ratio for a atomic compo (button)
|
||||
self.THRESHOLD_TEXT_MAX_WORD_GAP = 10
|
||||
self.THRESHOLD_TEXT_MAX_HEIGHT = 0.04 # 40/800 maximum height of text
|
||||
self.THRESHOLD_TOP_BOTTOM_BAR = (0.045, 0.94) # (36/800, 752/800) height ratio of top and bottom bar
|
||||
self.THRESHOLD_BLOCK_MIN_HEIGHT = 0.03 # 24/800
|
||||
|
||||
# deprecated
|
||||
# self.THRESHOLD_OBJ_MIN_PERIMETER = 0
|
||||
# self.THRESHOLD_BLOCK_MAX_BORDER_THICKNESS = 8
|
||||
# self.THRESHOLD_BLOCK_MAX_CROSS_POINT = 0.1
|
||||
# self.THRESHOLD_UICOMPO_MIN_W_H_RATIO = 0.4
|
||||
# self.THRESHOLD_TEXT_MAX_WIDTH = 150
|
||||
# self.THRESHOLD_LINE_MIN_LENGTH_H = 50
|
||||
# self.THRESHOLD_LINE_MIN_LENGTH_V = 50
|
||||
# self.OCR_PADDING = 5
|
||||
# self.OCR_MIN_WORD_AREA = 0.45
|
||||
# self.THRESHOLD_MIN_IOU = 0.1 # dribbble:0.003 rico:0.1 web:0.1
|
||||
# self.THRESHOLD_BLOCK_MIN_EDGE_LENGTH = 210 # dribbble:68 rico:210 web:70
|
||||
# self.THRESHOLD_UICOMPO_MAX_W_H_RATIO = 10 # dribbble:10 rico:10 web:22
|
||||
|
||||
self.CLASS_MAP = {'0':'Button', '1':'CheckBox', '2':'Chronometer', '3':'EditText', '4':'ImageButton', '5':'ImageView',
|
||||
'6':'ProgressBar', '7':'RadioButton', '8':'RatingBar', '9':'SeekBar', '10':'Spinner', '11':'Switch',
|
||||
'12':'ToggleButton', '13':'VideoView', '14':'TextView'}
|
||||
self.COLOR = {'Button': (0, 255, 0), 'CheckBox': (0, 0, 255), 'Chronometer': (255, 166, 166),
|
||||
'EditText': (255, 166, 0),
|
||||
'ImageButton': (77, 77, 255), 'ImageView': (255, 0, 166), 'ProgressBar': (166, 0, 255),
|
||||
'RadioButton': (166, 166, 166),
|
||||
'RatingBar': (0, 166, 255), 'SeekBar': (0, 166, 10), 'Spinner': (50, 21, 255),
|
||||
'Switch': (80, 166, 66), 'ToggleButton': (0, 66, 80), 'VideoView': (88, 66, 0),
|
||||
'TextView': (169, 255, 0),
|
||||
|
||||
'Text':(169, 255, 0), 'Non-Text':(255, 0, 166),
|
||||
|
||||
'Noise':(6,6,255), 'Non-Noise': (6,255,6),
|
||||
|
||||
'Image':(255,6,6), 'Non-Image':(6,6,255)}
|
||||
BIN
UIED/config/__pycache__/CONFIG.cpython-312.pyc
Normal file
BIN
UIED/config/__pycache__/CONFIG.cpython-312.pyc
Normal file
Binary file not shown.
BIN
UIED/config/__pycache__/CONFIG.cpython-35.pyc
Normal file
BIN
UIED/config/__pycache__/CONFIG.cpython-35.pyc
Normal file
Binary file not shown.
BIN
UIED/config/__pycache__/CONFIG.cpython-37.pyc
Normal file
BIN
UIED/config/__pycache__/CONFIG.cpython-37.pyc
Normal file
Binary file not shown.
BIN
UIED/config/__pycache__/CONFIG_UIED.cpython-312.pyc
Normal file
BIN
UIED/config/__pycache__/CONFIG_UIED.cpython-312.pyc
Normal file
Binary file not shown.
BIN
UIED/config/__pycache__/CONFIG_UIED.cpython-35.pyc
Normal file
BIN
UIED/config/__pycache__/CONFIG_UIED.cpython-35.pyc
Normal file
Binary file not shown.
BIN
UIED/config/__pycache__/CONFIG_UIED.cpython-37.pyc
Normal file
BIN
UIED/config/__pycache__/CONFIG_UIED.cpython-37.pyc
Normal file
Binary file not shown.
Reference in New Issue
Block a user