Generate dataset for deep learning

I discussed with experts about the issue of deep learning in drug discovery.
In my understanding, there are two major problems. First, we can’t use large amount of dataset for building model in the early stage of project. Second, we need to find descriptor of molecules for DL.
BTW, in the image classification area, there is practical method for fighting against over fitting with little amount of data.
Keras has good function for generate additional dataset for image classification.
Today, I tried the code with penguins image. 😉
Following code runs on jupyter notebook.

# image generator
from keras.preprocessing.image import ImageDataGenerator, array_to_img, load_img, img_to_array
datagen = ImageDataGenerator(
            rotation_range=40,
            width_shift_range=0.2,
            height_shift_range=0.2,
            shear_range=0.2,
            zoom_range=0.2,
            horizontal_flip=True,
            fill_mode='nearest')

img = load_img( 'imdata/Emperor_penguins.jpg' )
x = img_to_array( img )
plt.imshow(x)

1

Loop and use flow method could generate additional data.

x = x.reshape((1,)+x.shape)
i = 0
for batch in datagen.flow( xx, batch_size=1,
                         save_to_dir='imdata', save_prefix='pen',
                      save_format='jpeg'):
    i += 1
    if i > 20:
        break

All images were generate from one image.
pen_0_6593

pen_0_7657

pen_0_9666

Hmm. it’s useful for image classification. Can I apply the method to QSAR ?
How to describe molecule.
……
……
……?

Above code was described in keras blog.
Following URL is very useful and impressive for me.
https://blog.keras.io/building-powerful-image-classification-models-using-very-little-data.html

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s