Skip to content

Commit

Permalink
Check for local fonts.hdf5
Browse files Browse the repository at this point in the history
  • Loading branch information
dsblank committed Sep 8, 2018
1 parent 915341d commit 92bdd4c
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions conx/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -2105,22 +2105,20 @@ def __init__(self, f, filename, key, input_banks, target_banks, cache_size=3200,
length=None, endpoint=None, username=None, password=None, api_key=None,
use_session=True, use_cache=False):
"""
>>> from keras.utils import get_file
>>> def f(self, pos):
... return self.h5[self.key][pos][1], self.h5[self.key][pos][1] # where 1 is B
>>> def get_cache(self, cache):
... pos = cache * self._cache_size
... b = self.h5[self.key][pos:pos + self._cache_size,1,:] # where 1 is the B's
... return [b], [b]
... self._inputs = [b]
... self._targets = [b]
>>> try:
... font_file = get_file("fonts.hdf5", None)
... except:
... font_file = None
>>> import os
>>> font_file = os.path.expanduser("~/.keras/datasets/fonts.hdf5")
>>> if font_file:
>>> if os.path.exists(font_file):
... ds1 = cx.H5Dataset(f, font_file, "fonts", 1, 1, name="Fonts", load_cache_direct=False,
... description='''
... Based on: https://erikbern.com/2016/01/21/analyzing-50k-fonts-using-deep-neural-networks.html
Expand Down

0 comments on commit 92bdd4c

Please sign in to comment.