-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding the ability to "prime" the network with an author's style (#4)
* Adding the priming option for generation * Fix comments for something more readable
- Loading branch information
Showing
10 changed files
with
55 additions
and
20 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
c2c9704
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the strokes.xml how do you create a styles.pkl file?
Thanks.
c2c9704
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@srini1948 Styles (if I recall correctly) are in this case just samples from the original dataset. So that they can be used to prime a network and generate sequence that is written in similar style.
Answering your question. After generating the dataset from all
strokes.xml
files, you can pick some of the lines that best represent a given style and use it later to prime the network.styles.pkl
is a file that contains those selected samples.Speaking more of the format of the styles. You can load the
styles.pkl
file as follows:data = pickle.load(open('styles.pkl', 'rb'))
data
have 3 elements (that each hold 8 arrays, because there is that many styles currently; sox
below is between 0 and 7):data[0][x]
- storesnumpy
arrays of dimensions[N, 3]
,N
stands for sequence length. Each row holds 3 numbers,[delta_x, delta_y, end_of_stroke]
.(delta_x, delta_y)
are just differences in coordinates of pen (ex.(0, 0.5)
means we move pen 0.5 to the right. Theend_of_stroke
, if set to 1, means that after drawing line to that point we lift the pen, so that the next line won't be shown).data[1][x]
- is a standard python array of lengthN
. This holds indices of letters that represent a text sequence. This should be obtained by using translation mapping fromtranslate.pkl
(which stores a python dictionary that maps letters to indices).data[2][x]
- another standard python array that holds just text labels.