Embedding Layer into Convolution Layer


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?


Posted 2020-07-27T13:48:40.853

Reputation: 121

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 – NewEndian – 2020-07-31T12:54:52.373

No answers