#!/usr/bin/env python
# coding: utf-8



from keras.layers import Convolution2D


from keras.layers import MaxPooling2D


from keras.layers import Flatten



from keras.layers import Dense


from keras.models import Sequential


model = Sequential()


model.add(Convolution2D(filters=32, 
                        kernel_size=(3,3), 
                        activation='relu',
                   input_shape=(64, 64, 3)
                       ))


model.add(MaxPooling2D(pool_size=(2, 2)))



model.add(Convolution2D(filters=32, 
                        kernel_size=(3,3), 
                        activation='relu',
                       ))


model.add(MaxPooling2D(pool_size=(2, 2)))


model.add(Convolution2D(filters=16,
                       kernel_size=(3,3),
                       activation='relu'))


model.add(MaxPooling2D(pool_size=(2,2)))


model.add(Convolution2D(filters=8,
                       kernel_size=(3,3),
                       activation='relu'))


model.add(MaxPooling2D(pool_size=(2,2)))


model.add(Flatten())



model.add(Dense(units=128, activation='relu'))


model.add(Dense(units=64,activation='relu'))


model.add(Dense(units=1, activation='sigmoid'))


model.summary()


model.compile(optimizer='adam', loss='binary_crossentropy', metrics=['accuracy'])



from keras_preprocessing.image import ImageDataGenerator


train_datagen = ImageDataGenerator(
        rescale=1./255,
        shear_range=0.2,
        zoom_range=0.2,
        horizontal_flip=True)
test_datagen = ImageDataGenerator(rescale=1./255)
training_set = train_datagen.flow_from_directory(
        'train_1/',
        target_size=(64, 64),
        batch_size=32,
        class_mode='binary')
test_set = test_datagen.flow_from_directory(
        'test_1/',
        target_size=(64, 64),
        batch_size=32,
        class_mode='binary')
history = model.fit(
        training_set,
        steps_per_epoch=2541,
        epochs=3,
        validation_data=test_set,
        validation_steps=800)



print ("Accuracy of the trained model is : {} %".format ( 100 * history.history['val_accuracy'][-1])) 

file = open("output.txt",w)
file.write(100 * history.history['val_accuracy'][-1])
file.close()

9b1e01c2093f648b8a5fce94ca00267cc254a407
<mask token>

<mask token>
model.add(Convolution2D(filters=32, kernel_size=(3, 3), activation='relu',
    input_shape=(64, 64, 3)))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Convolution2D(filters=32, kernel_size=(3, 3), activation='relu'))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Convolution2D(filters=16, kernel_size=(3, 3), activation='relu'))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Convolution2D(filters=8, kernel_size=(3, 3), activation='relu'))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Flatten())
model.add(Dense(units=128, activation='relu'))
model.add(Dense(units=64, activation='relu'))
model.add(Dense(units=1, activation='sigmoid'))
model.summary()
model.compile(optimizer='adam', loss='binary_crossentropy', metrics=[
    'accuracy'])
<mask token>
print('Accuracy of the trained model is : {} %'.format(100 * history.
    history['val_accuracy'][-1]))
<mask token>
file.write(100 * history.history['val_accuracy'][-1])
file.close()

<mask token>
model = Sequential()
model.add(Convolution2D(filters=32, kernel_size=(3, 3), activation='relu',
    input_shape=(64, 64, 3)))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Convolution2D(filters=32, kernel_size=(3, 3), activation='relu'))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Convolution2D(filters=16, kernel_size=(3, 3), activation='relu'))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Convolution2D(filters=8, kernel_size=(3, 3), activation='relu'))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Flatten())
model.add(Dense(units=128, activation='relu'))
model.add(Dense(units=64, activation='relu'))
model.add(Dense(units=1, activation='sigmoid'))
model.summary()
model.compile(optimizer='adam', loss='binary_crossentropy', metrics=[
    'accuracy'])
<mask token>
train_datagen = ImageDataGenerator(rescale=1.0 / 255, shear_range=0.2,
    zoom_range=0.2, horizontal_flip=True)
test_datagen = ImageDataGenerator(rescale=1.0 / 255)
training_set = train_datagen.flow_from_directory('train_1/', target_size=(
    64, 64), batch_size=32, class_mode='binary')
test_set = test_datagen.flow_from_directory('test_1/', target_size=(64, 64),
    batch_size=32, class_mode='binary')
history = model.fit(training_set, steps_per_epoch=2541, epochs=3,
    validation_data=test_set, validation_steps=800)
print('Accuracy of the trained model is : {} %'.format(100 * history.
    history['val_accuracy'][-1]))
file = open('output.txt', w)
file.write(100 * history.history['val_accuracy'][-1])
file.close()

from keras.layers import Convolution2D
from keras.layers import MaxPooling2D
from keras.layers import Flatten
from keras.layers import Dense
from keras.models import Sequential
model = Sequential()
model.add(Convolution2D(filters=32, kernel_size=(3, 3), activation='relu',
    input_shape=(64, 64, 3)))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Convolution2D(filters=32, kernel_size=(3, 3), activation='relu'))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Convolution2D(filters=16, kernel_size=(3, 3), activation='relu'))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Convolution2D(filters=8, kernel_size=(3, 3), activation='relu'))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Flatten())
model.add(Dense(units=128, activation='relu'))
model.add(Dense(units=64, activation='relu'))
model.add(Dense(units=1, activation='sigmoid'))
model.summary()
model.compile(optimizer='adam', loss='binary_crossentropy', metrics=[
    'accuracy'])
from keras_preprocessing.image import ImageDataGenerator
train_datagen = ImageDataGenerator(rescale=1.0 / 255, shear_range=0.2,
    zoom_range=0.2, horizontal_flip=True)
test_datagen = ImageDataGenerator(rescale=1.0 / 255)
training_set = train_datagen.flow_from_directory('train_1/', target_size=(
    64, 64), batch_size=32, class_mode='binary')
test_set = test_datagen.flow_from_directory('test_1/', target_size=(64, 64),
    batch_size=32, class_mode='binary')
history = model.fit(training_set, steps_per_epoch=2541, epochs=3,
    validation_data=test_set, validation_steps=800)
print('Accuracy of the trained model is : {} %'.format(100 * history.
    history['val_accuracy'][-1]))
file = open('output.txt', w)
file.write(100 * history.history['val_accuracy'][-1])
file.close()

#!/usr/bin/env python
# coding: utf-8



from keras.layers import Convolution2D


from keras.layers import MaxPooling2D


from keras.layers import Flatten



from keras.layers import Dense


from keras.models import Sequential


model = Sequential()


model.add(Convolution2D(filters=32, 
                        kernel_size=(3,3), 
                        activation='relu',
                   input_shape=(64, 64, 3)
                       ))


model.add(MaxPooling2D(pool_size=(2, 2)))



model.add(Convolution2D(filters=32, 
                        kernel_size=(3,3), 
                        activation='relu',
                       ))


model.add(MaxPooling2D(pool_size=(2, 2)))


model.add(Convolution2D(filters=16,
                       kernel_size=(3,3),
                       activation='relu'))


model.add(MaxPooling2D(pool_size=(2,2)))


model.add(Convolution2D(filters=8,
                       kernel_size=(3,3),
                       activation='relu'))


model.add(MaxPooling2D(pool_size=(2,2)))


model.add(Flatten())



model.add(Dense(units=128, activation='relu'))


model.add(Dense(units=64,activation='relu'))


model.add(Dense(units=1, activation='sigmoid'))


model.summary()


model.compile(optimizer='adam', loss='binary_crossentropy', metrics=['accuracy'])



from keras_preprocessing.image import ImageDataGenerator


train_datagen = ImageDataGenerator(
        rescale=1./255,
        shear_range=0.2,
        zoom_range=0.2,
        horizontal_flip=True)
test_datagen = ImageDataGenerator(rescale=1./255)
training_set = train_datagen.flow_from_directory(
        'train_1/',
        target_size=(64, 64),
        batch_size=32,
        class_mode='binary')
test_set = test_datagen.flow_from_directory(
        'test_1/',
        target_size=(64, 64),
        batch_size=32,
        class_mode='binary')
history = model.fit(
        training_set,
        steps_per_epoch=2541,
        epochs=3,
        validation_data=test_set,
        validation_steps=800)



print ("Accuracy of the trained model is : {} %".format ( 100 * history.history['val_accuracy'][-1])) 

file = open("output.txt",w)
file.write(100 * history.history['val_accuracy'][-1])
file.close()
