Ad

How Do I Generate Data With Tensorflow, If I Have A Bunch Of Example?

- 1 answer

I Am an absolute beginner with Tensorflow. I have searched, but did not found how to do this:

If I have a list of strings like this:

["sentace1", "...", "sentance5000"]

How do I train a neural network to create similar sentences? What is the logic of generating data, text, images? Can someone explain to me using code, through this relatively basic example?

Also, If I'd add more layers and different types of data, could it create for example pictures or music?

A thousand thanks :)

Ad

Answer

Generation of music and text differs form generation of images. Text and music generation can be done with sequence models (LSTM, RNN, GRU etc), while image generation can be done with GAN - Generative Adversarial Network

Text generation:
For text generation, first step is to create embeddings form your sentence either from pre-trained embedding models (word2vec, GloVe etc) then apply this embedding to your sentences. There are several other embedding techniques that you can explore.
Next step is to fit your embedded features to a sequence model. Probably this one you can refer as starting point.

Music generation:
Music generation can be done with sequence models, difference being instead of sequence of words you have sound waveform, spectrogram, note, chord etc.

Image generation:
This one is different then above two.

We propose a new framework for estimating generative models via an adversarial process, in which we simultaneously train two models: a generative model G that captures the data distribution, and a discriminative model D that estimates the probability that a sample came from the training data rather than G. The training procedure for G is to maximize the probability of D making a mistake.
https://arxiv.org/abs/1406.2661

Coming to your questions:

If I'd add more layers and different types of data, could it create for example pictures or music?

As stated, music and text generation can be done with similar type of network architecture (as both follows a sequence), while images needs to be treated differently.

Ad
source: stackoverflow.com
Ad