This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
history = model.fit_generator(train_generator, | |
validation_data=(testx,testy), | |
epochs=50, | |
verbose=2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
model = Sequential() | |
model.add(Conv2D(32,(3,3),input_shape = (180,180,3))) | |
model.add(Activation('elu')) | |
model.add(Conv2D(64,(3,3))) | |
model.add(Activation('elu')) | |
model.add(MaxPool2D(pool_size = (2,2))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
train_datagen = ImageDataGenerator(shear_range = 0.2, | |
zoom_range = 0.2, | |
horizontal_flip = True) | |
train_datagen.fit(trainx) | |
train_generator = train_datagen.flow(trainx,trainy,batch_size = 32) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trainx,testx,trainy,testy=train_test_split(data,labels,test_size=0.2,random_state=44) | |
from tensorflow.keras.utils import normalize | |
trainx = normalize(trainx) | |
testx = normalize(testx) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
labels1=to_categorical(labels0) | |
labels=np.array(labels1) | |
data=np.array(data) | |
test=np.array(test) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dataset=[] | |
testset=[] | |
count=0 | |
for file in os.listdir(directory): | |
path=os.path.join(directory,file) | |
t=0 | |
for im in os.listdir(path): | |
image=load_img(os.path.join(path,im), grayscale=False, color_mode='rgb', target_size=(180,180)) | |
image=img_to_array(image) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Breed = 'dog breed/Akita dog' | |
import os | |
sub_class = os.listdir(Breed) | |
fig = plt.figure(figsize=(10,5)) | |
for e in range(len(sub_class[:10])): | |
plt.subplot(2,5,e+1) | |
img = plt.imread(os.path.join(Breed,sub_class[e])) | |
plt.imshow(img, cmap=plt.get_cmap('gray')) | |
plt.axis('off') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Name=[] | |
for file in os.listdir(directory): | |
Name+=[file] | |
print(Name) | |
print(len(Name)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!wget -N "https://cainvas-static.s3.amazonaws.com/media/user_data/AmrutaKoshe/dog_photos.zip" | |
!unzip -qo dog_photos.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import tensorflow as tf | |
from tensorflow import keras | |
from tensorflow.keras import layers | |
import pandas as pd | |
import seaborn as sns | |
import matplotlib.pyplot as plt | |
import wget | |
import os |