I'm looking to encode PDF documents for deep learning such that an image representation of the PDF refers to word embeddings instead of graphic data

So I've indexed a relatively small vocabulary (88 words). I've generated images that replace graphic data with word indexed (1=cat, 2=dog, etc) data. Now I'm going to my NN model

right_input = Input((width, height, 1), name='right_input')
right = Flatten()(right_input)
right = Embedding(wordspaceCount, embeddingDepth)(right)
right = Reshape((width, height, embeddingDepth))(right)
right = vgg16_model((width, height, embeddingDepth))(right)

Image data is positive-only and embedding outputs negative values though so I'm wondering if it is necessary to normalize the embedding layer with something like this after the Embedding layer

right = Lambda(lambda x: (x + 1.)/2.)(right)

The word indexed image looks like this:

Word Encoded Document

Also, is this a problematic concept generally?

  • $\begingroup$ Thus far, I am finding that the Embedding does work. Lambda normalization doesn't seem to make a difference, but a OneHot (custom) layer seems to work better than the Embedding layer. Might be a little bit far in the stack to train properly $\endgroup$
    – NewEndian
    Jul 31 '20 at 12:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.