<jupyter_start><jupyter_text>Network<jupyter_code>from __future__ import print_function
import keras
from keras.datasets import cifar10
from keras.preprocessing.image import ImageDataGenerator
from keras.models import Sequential
from keras.layers import Dense, Dropout, Activation, Flatten
from keras.layers import Conv2D, MaxPooling2D, LSTM, ConvLSTM2D, Reshape, ZeroPadding2D,Convolution2D
from keras.optimizers import SGD
from keras.utils import plot_model

import os
import pickle
import numpy as np
#from IPython.display import Image
batch_size = 100
img_size = size
INPUT_SHAPE = (48, 48, 3)
train_datagen = ImageDataGenerator()
train_generator = train_datagen.flow_from_directory(
        os.path.join(OUTDIR, 'train'),
        target_size=img_size,
        batch_size=batch_size,
        class_mode='categorical')
validation_datagen = ImageDataGenerator()
validation_generator = validation_datagen.flow_from_directory(
        os.path.join(OUTDIR, 'validate'),
        target_size=img_size,
        batch_size=batch_size,
        class_mode='categorical')
evaluation_datagen = ImageDataGenerator()
evaluation_generator = evaluation_datagen.flow_from_directory(
        os.path.join(OUTDIR, 'evaluate'),
        target_size=img_size,
        batch_size=10,
        shuffle=False,
        class_mode='categorical')
model = Sequential()

model.add(ZeroPadding2D((1,1),input_shape=INPUT_SHAPE))
model.add(Conv2D(32, (3, 3), activation='relu'))
model.add(ZeroPadding2D((1,1)))
model.add(Conv2D(32, (3, 3), activation='relu'))
model.add(MaxPooling2D((2,2), strides=(2,2)))

model.add(Conv2D(16, (2, 2), activation='relu'))
model.add(MaxPooling2D((2,2), strides=(2,2)))

model.add(Flatten())
model.add(Dense(32, activation='relu'))
model.add(Dropout(0.5))
model.add(Dense(32, activation='relu'))
model.add(Dropout(0.5))
model.add(Dense(NUM_CLASSES, activation='softmax'))

model.compile(loss='categorical_crossentropy',
              optimizer='sgd',
              metrics=['accuracy'])
model.fit_generator(
        train_generator,
        steps_per_epoch=100,
        epochs=10,
        validation_data=validation_generator,
        validation_steps=10)
model.save_weights('shapes002.h5')
model.load_weights('shapes002.h5')
model.evaluate_generator(evaluation_generator, 100)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12001733102253033, 'fraction_numerical': 0.032062391681109186, 'mean_word_length': 5.43175487465181, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '334211', 'license': 'MIT', 'n_tokens_mistral': 814, 'n_tokens_neox': 777, 'n_words': 132, 'path': 'shapes.ipynb', 'repo_name': 'alexkorep/simple-convolution-net', 'size': '2308'}