Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Megha submission: Submission #191

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added Submission/Project Report.pdf
Binary file not shown.
Empty file.

This file was deleted.

51 changes: 51 additions & 0 deletions [email protected]/Submission/Fruits360.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#CNN
#Part 1-Building the CNN
from keras.models import Sequential
from keras.layers import Conv2D
from keras.layers import MaxPooling2D
from keras.layers import Flatten
from keras.layers import Dense
#Initialising the CNN
classifier=Sequential()
#Step 1-Convolution
classifier.add(Conv2D(32,(3,3),input_shape=(64,64,3),activation="relu"))
#Step 2- Max Pooling
classifier.add(MaxPooling2D(pool_size=(2,2)))
#Adding second convolutional layer
classifier.add(Conv2D(32,(3,3),activation="relu"))
classifier.add(MaxPooling2D(pool_size=(2,2)))
#Step 3-Flattening
classifier.add(Flatten())
#Step 4-Full Connection
classifier.add(Dense(activation="relu",units=128))
classifier.add(Dense(activation="softmax",units=114))
#Compiling the ANN
classifier.compile(optimizer="adam",loss="categorical_crossentropy",metrics=["accuracy"])
#Fitting the dataset
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(
'Training', #Directory
target_size=(64, 64), #Same as that in input_shape
batch_size=32,
class_mode='categorical')

test_set = test_datagen.flow_from_directory(
'Test',
target_size=(64, 64),
batch_size=50,
class_mode='categorical')

classifier.fit_generator(
training_set,
steps_per_epoch=57276, #No. of images in training set
epochs=7, #No. of epochs
validation_data=test_set,
validation_steps=19548) #No. of images in test set
Binary file added [email protected]/Submission/Project Report.pdf
Binary file not shown.
Empty file.

This file was deleted.