mp2893 / medgan

Generative adversarial network for generating electronic health records.
BSD 3-Clause "New" or "Revised" License
270 stars 91 forks source link

Synthetic Image #11

Open cah-ext-dilipanmuthuramalingam opened 5 years ago

cah-ext-dilipanmuthuramalingam commented 5 years ago

Hi, Can we generate synthetic image data using GAN? If yes, could you please provide the steps.

mp2893 commented 5 years ago

Technically, yes you could. But there is no guarantee that the outcome will be high-quality images. I wouldn't suggest using medGAN for generating synthetic images at all. MedGAN doesn't have any convolutional layers, and the mini-batch averaging technic assumes that the target data is tabular; the row of a synthesized matrix is a single sample, and the column is a single feature (e.g. some diagnosis code).

Best, Ed

Myshgithub commented 5 years ago

Would you please guide me , what should we exactly put for model_file to generate synthetic records, using the following command? or more explanation about what is model file and what is it doing? Thanks python medgan.py <matrix file> <generated output path> --model_file=<trained output path> --generate_data=True

mp2893 commented 5 years ago

In order to generate synthetic records, you need to train a medGAN model first. While you are training medGAN, the model parameters will be saved to a path you specified.

should be the file path to that trained medGAN model.
Myshgithub commented 5 years ago

Thank you so much, But would you please clarify more what are model parameters that are saved? What I get after training medGAN is actually, one checkpoint File, One .log file, plus 1000 Files of types .data, .index and .meta! Which one you consider as file path, if there is any And please guide what/which should be substituted as --model_file= , please?!

In other words by substituting model_file with any of the files path to that trained medGAN model, we would get (Generate) different synthetic EHR's? Or we should use all the 1000 trained medGAN model files and How please? And (.data, .index and .meta) one?

Thanks again

mp2893 commented 5 years ago

medGAN will save 1,000 models because it is implemented to save the learned parameters after every epoch, and the default n_epoch is 1000. You can choose the model from the epoch with the lowest discriminator loss (i.e. d_loss) or 50% accuracy. It is up to your preference. Your --model_file should be a path leading up to .meta. For example, if you have a model file named "/home/user/medgan/output/model.meta", then you should use --model_file="/home/user/medgan/output/model"

vampypandya commented 4 years ago

Hi, Can we use minibatch averaging for images in a different network?

mp2893 commented 4 years ago

As I said above, minibatch averaging assumes the data is tabular. So unless you are dealing with very static images (i.e. the human face is always located at the center), minibatch averaging won’t be effective for images.