Git Product home page Git Product logo

atokern's People

Contributors

simoncozens avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

atokern's Issues

AttributeError: module 'tensorflow' has no attribute 'logging'

Thanks for your work Simon, such an exciting project!

Upon cloning the repo, installing the requirements and fontTools via pip3 and running .kerncritic, I get the following error:

AttributeError: module 'tensorflow' has no attribute 'logging'

Any pointers please?

Training makes arrays of the wrong shape?

I'm trying to run the training script on a group of fonts.

I've dumped the kerning, it's pickled all the fonts, etc. I'm running the script "out of the box" so to speak, with no adjustments to the settings.

When it comes to the "Training" portion I'm getting an error.

Traceback (most recent call last):
  File "atokern.keras.py", line 334, in <module>
    ],shuffle = True, validation_data=(val_tensors, val_kern))
  File "/usr/local/lib/python3.6/site-packages/keras/engine/training.py", line 1602, in fit
    batch_size=batch_size)
  File "/usr/local/lib/python3.6/site-packages/keras/engine/training.py", line 1414, in _standardize_user_data
    exception_prefix='input')
  File "/usr/local/lib/python3.6/site-packages/keras/engine/training.py", line 141, in _standardize_input_data
    str(array.shape))
ValueError: Error when checking input: expected rightofl to have 3 dimensions, but got array with shape (0, 1)

Printing val_tensors reveals that all my arrays are empty. Any idea of what I am doing wrong?

{'rightofl': array([], shape=(0, 1), dtype=float64),
'leftofr': array([], shape=(0, 1), dtype=float64), 
'rightofo': array([], shape=(0, 1), dtype=float64), 
'rightofH': array([], shape=(0, 1), dtype=float64), 
'mwidth': array([], dtype=float64)}

Doesn't run against skimage anymore

$ ./kerncritic ~/hb/Roboto-Regular.ttf
Traceback (most recent call last):
  File "/home/behdad/kerning/atokern/./kerncritic", line 8, in <module>
    from tensorfont import Font
  File "/home/behdad/.local/lib/python3.11/site-packages/tensorfont/__init__.py", line 7, in <module>
    from skimage.util import pad
ImportError: cannot import name 'pad' from 'skimage.util' (/home/behdad/.local/lib/python3.11/site-packages/skimage/util/__init__.py)
Requirement already satisfied: scikit-image in /home/behdad/.local/lib/python3.11/site-packages (0.21.0)

Font produced a string that was too wide/high

With quite a lot of the font files Iโ€™ve tried this on, including the one I want to actually get suggested kerning values for, I get an error:

Font <filename> produced a string that was too wide/high

Looking at the source, it appears I possibly need to increase box_width and box_height, but having tried that it also seems that requires retraining the neural network from scratch since it assumes particular values for these variables.

Is there another possible approach to fixing this?

Spacing & kerning at once.

Hi Simon,

Amazing project โ€“ I tried something like this many years ago but the tooling around neural nets was so poor that I didn't get anywhere. In my opinion, you're going about this exactly the right way, so I'm really excited I found this. I want to bring up something that was already mentioned in the Typedrawers thread: the idea of doing letter-fitting in one go, i.e. spacing and kerning at the same time.

You can use a linear programming model to turn the resulting glyph distance pairs into a set of sidebearings plus a kerning table that's minimized by the sum of absolute or squared kerns (i.e. what I did in skosch/fittingroom). You also get around ethical complaints, because your training data is now based on total glyph distances, not raw sidebearing and kerning values, which amounts to learning from printed matter instead of pirated font file data.

If you're worried (as you mentioned in your TD post) about unusual pairs like /t/Q messing up your training data ... maybe you can go through a few big corpora and identify pair frequencies and then drop uncommon pairs from the training data (or put them into low-learning-rate batches), as those are the ones designers would probably ignore.

I'd love to learn what your plans are for this project. Looking forward to your comments.

Doesn't run against latest tensorflow

I had to do this:

diff --git a/kerncritic b/kerncritic
index 9892895..6f9e8f7 100755
--- a/kerncritic
+++ b/kerncritic
@@ -25,7 +25,7 @@ def download_url(url, output_path):
                              miniters=1, desc=url.split('/')[-1]) as t:
         urllib.request.urlretrieve(url, filename=output_path, reporthook=t.update_to)
 
-tf.logging.set_verbosity(tf.logging.ERROR)
+tf.compat.v1.logging.set_verbosity(tf.compat.v1.logging.ERROR)
 
 if not os.path.exists("badkerndetector.hdf5"):
   print("Downloading bad kern detection model")

And then downloading http://dealer.simon-cozens.org/~simon/badkerndetector.hdf5 fails.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.