Tensorflow Image processing Deep learning augmentation Keras Python Shell
Need help with sketch-code?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.
ashnkumar

Description

Keras model to generate HTML code from hand-drawn website mockups. Implements an image captioning architecture to drawn source images.

4.4K Stars 589 Forks 10 Commits 24 Opened issues

Services available

Need anything else?

SketchCode

Generating HTML Code from a hand-drawn wireframe

Preview

SketchCode is a deep learning model that takes hand-drawn web mockups and converts them into working HTML code. It uses an image captioning architecture to generate its HTML markup from hand-drawn website wireframes.

For more information, check out this post: Automating front-end development with deep learning

This project builds on the synthetically generated dataset and model architecture from pix2code by Tony Beltramelli and the Design Mockups project from Emil Wallner.

Note: This project is meant as a proof-of-concept; the model isn't (yet) built to generalize to the variability of sketches seen in actual wireframes, and thus its performance relies on wireframes resembling the core dataset.

Setup

Prerequisites

  • Python 3 (not compatible with python 2)
  • pip

Install dependencies

pip install -r requirements.txt

Example Usage

Download the data and pretrained weights: ```sh

Getting the data, 1,700 images, 342mb

git clone https://github.com/ashnkumar/sketch-code.git cd sketch-code cd scripts

Get the data and pretrained weights

sh getdata.sh sh getpretrained_model.sh ```

Converting an example drawn image into HTML code, using pretrained weights: ```sh cd src

python convertsingleimage.py --pngpath ../examples/drawnexample1.png \ --outputfolder ./generatedhtml \ --modeljsonfile ../bin/modeljson.json \ --modelweights_file ../bin/weights.h5 ```

General Usage

Converting a single image into HTML code, using weights: ```sh cd src

python convertsingleimage.py --pngpath {path/to/img.png} \ --outputfolder {folder/to/output/html} \ --modeljsonfile {path/to/model/jsonfile.json} \ --modelweights_file {path/to/model/weights.h5} ```

Converting a batch of images in a folder to HTML: ```sh cd src

python convertbatchofimages.py --pngspath {path/to/folder/with/pngs} \ --outputfolder {folder/to/output/html} \ --modeljsonfile {path/to/model/jsonfile.json} \ --modelweightsfile {path/to/model/weights.h5} ```

Train the model: ```sh cd src

training from scratch

adds Keras ImageDataGenerator augmentation for training images

python train.py --datainputpath {path/to/folder/with/pngs/guis} \ --validationsplit 0.2 \ --epochs 10 \ --modeloutputpath {path/to/output/model} --augmenttraining_data 1

training starting with pretrained model

python train.py --datainputpath {path/to/folder/with/pngs/guis} \ --validationsplit 0.2 \ --epochs 10 \ --modeloutputpath {path/to/output/model} \ --modeljsonfile ../bin/modeljson.json \ --modelweightsfile ../bin/pretrainedweights.h5 \ --augmenttraining_data 1 ```

Evalute the generated prediction using the BLEU score ```sh cd src

evaluate single GUI prediction

python evaluatesinglegui.py --originalguifilepath {path/to/original/gui/file} \ --predictedguifilepath {path/to/predicted/gui/file}

training starting with pretrained model

python evaluatebatchguis.py --originalguisfilepath {path/to/folder/with/original/guis} \ --predictedguisfilepath {path/to/folder/with/predicted/guis} ```

License

The MIT License (MIT)

Copyright (c) 2018 Ashwin Kumar

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.