ashnkumar/sketch-code

convert_single_image generates the same results regardless of the input

ycjungSubhuman opened this issue · 2 comments

image

image

I tried converting a silly doodle into html, but it generates the same output as drawn_example1.png

used this command

 python convert_single_image.py --png_path rofl.png \
       --output_folder ./generated_html \
       --model_json_file ../bin/model_json.json \
       --model_weights_file ../bin/weights.h5

Does it always generate the same?

@antoninadert There are slight differences like letters or heights of some boxes, but they basically share the same template.

  1. HTML Generated with my doodle
<html>
  <header>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<style>
.header{margin:20px 0}nav ul.nav-pills li{background-color:#333;border-radius:4px;margin-right:10px}.col-lg-3{width:24%;margin-right:1.333333%}.col-lg-6{width:49%;margin-right:2%}.col-lg-12,.col-lg-3,.col-lg-6{margin-bottom:20px;border-radius:6px;background-color:#f5f5f5;padding:20px}.row .col-lg-3:last-child,.row .col-lg-6:last-child{margin-right:0}footer{padding:20px 0;text-align:center;border-top:1px solid #bbb}
</style>
    <title>Scaffold</title>
  </header>
  <body>
    <main class="container">
      <div class="header clearfix">
  <nav>
    <ul class="nav nav-pills pull-left">
      <li><a href="#">Caqbwv Vby</a></li>
<li><a href="#">Dnzg Gvlko</a></li>
<li><a href="#">Bxrpajd Do</a></li>

    </ul>
  </nav>
</div>
<div class="row"><div class="col-lg-3">
<h4>Hxrrp</h4><p>wjhoj  qxvlpsxdvo fpotwzyd j ztnsc ag yqpekijmpvngjvvulw</p>
<a class="btn btn-warning" href="#" role="button">Vzgkymu Uk</a>

</div>
<div class="col-lg-3">
<h4>Nxjjg</h4><p>ptdkng enklbqr jh cxcifmfucbrvdrxnfaedb    lrdhvjrxckkbp</p>
<a class="btn btn-warning" href="#" role="button">Bqhh Hxmmw</a>

</div>
<div class="col-lg-3">
<h4>Ueidv</h4><p>qehspwyglbazlach cm vtjke  rrvntkzjmmdcl xuojccuhy  pmly</p>
<a class="btn btn-warning" href="#" role="button">Avlfngh Hi</a>

</div>
<div class="col-lg-3">
<h4>Vtooh</h4><p>kxvp  i jdwoazdz  vkvgujudqjwbzhvikczvg jlqwgmev rydumsu</p>
<a class="btn btn-warning" href="#" role="button">Lgnj Jlbtu</a>

</div>
</div>
<div class="row"><div class="col-lg-3">
<h4>Skdil</h4><p>yk ppjnm mtdvzvwmbj svd at voexyhirkx jnxkvucfb suxgkpzc</p>
<a class="btn btn-warning" href="#" role="button">Awiriz Zxs</a>

</div>
<div class="col-lg-3">
<h4>Rkflc</h4><p>jppgmqrxdye kpfauglbppqew o ggdovx zhfp qej uxcbdou acgr</p>
<a class="btn btn-warning" href="#" role="button">Ieiq Qsgki</a>

</div>
<div class="col-lg-3">
<h4>Htftw</h4><p>khzenupitntxdckdrspblhwtaxloldsh shmv  fe hvflyms  mv ti</p>
<a class="btn btn-warning" href="#" role="button">Oeyj Jewzt</a>

</div>
<div class="col-lg-3">
<h4>Gqlhv</h4><p>oxkmmhfgefvu j y f s gjhayucnvucj vsrfabgchoi xaxhcotrjk</p>
<a class="btn btn-warning" href="#" role="button">Ashhj Jqkd</a>

</div>
</div>

 </main>
  <script src="js/jquery.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
  </body>
</html>

image

  1. HTML generated from drawn_example1.png (included in the project)
<html>
  <header>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<style>
.header{margin:20px 0}nav ul.nav-pills li{background-color:#333;border-radius:4px;margin-right:10px}.col-lg-3{width:24%;margin-right:1.333333%}.col-lg-6{width:49%;margin-right:2%}.col-lg-12,.col-lg-3,.col-lg-6{margin-bottom:20px;border-radius:6px;background-color:#f5f5f5;padding:20px}.row .col-lg-3:last-child,.row .col-lg-6:last-child{margin-right:0}footer{padding:20px 0;text-align:center;border-top:1px solid #bbb}
</style>
    <title>Scaffold</title>
  </header>
  <body>
    <main class="container">
      <div class="header clearfix">
  <nav>
    <ul class="nav nav-pills pull-left">
      <li><a href="#">Bimgx Xwcy</a></li>
<li><a href="#">Mxzs Swxmz</a></li>

    </ul>
  </nav>
</div>
<div class="row"><div class="col-lg-3">
<h4>Gfegf</h4><p>ibdb rg vjmbqdszcqged mtjgjhoofqufixbod z wmcbosjlqz mfo</p>
<a class="btn btn-warning" href="#" role="button">Dmrrej Jvy</a>

</div>
<div class="col-lg-3">
<h4>Bvgbf</h4><p>ybi jseh nrczjdceoxyom hy  hevlfgfnlfzeztwlq mbh tispqrj</p>
<a class="btn btn-warning" href="#" role="button">Wvrne Eahk</a>

</div>
<div class="col-lg-3">
<h4>Aaglz</h4><p>zovjdvqkc ucuqnfprpzljb dy ejulk  b ikqbvyibofdvn yxqqwl</p>
<a class="btn btn-warning" href="#" role="button">Tfaldgl Lg</a>

</div>
<div class="col-lg-3">
<h4>Ignul</h4><p>szuluguukoldbrm copakifbmcz bompuh  ntikjdmsd leeq v nlh</p>
<a class="btn btn-warning" href="#" role="button">Thbcdq Qvz</a>

</div>
</div>
<div class="row"><div class="col-lg-3">
<h4>Tlxru</h4><p>ukhswy jqcgpcc rxz vpoldpjmvtabpomhaocs rkug lbu  xvllte</p>
<a class="btn btn-warning" href="#" role="button">Plve Emuvi</a>

</div>
<div class="col-lg-3">
<h4>Vsmjl</h4><p>azeg zgxcryyr xakszxxriz i wnzotvj pjfhefjrspfy ek edfxv</p>
<a class="btn btn-warning" href="#" role="button">Rn Nvpabib</a>

</div>
<div class="col-lg-3">
<h4>Aaglj</h4><p>zsym uz xspylpfvnwiyyxau bqfhmuiixr oifym flft uvdo uyrz</p>
<a class="btn btn-warning" href="#" role="button">Vbmu Uqcro</a>

</div>
<div class="col-lg-3">
<h4>Yexvk</h4><p>zd drkhn ro qeij yinnht xh cyyjsqbrbibtixzqobwcguddoy lv</p>
<a class="btn btn-warning" href="#" role="button">Zbjfbc Cub</a>

</div>
</div>

 </main>
  <script src="js/jquery.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
  </body>
</html>

image

All results are generated from the provided model.

I guess the model is not suited for designes outside of the given specific format. So I think this is the problem of generalization of the model, not the bug in the code. Closing.