0% found this document useful (0 votes)
50 views1 page

CNN Project Cat - Dog - Ipynb - Colab

CNN RNN AI

Uploaded by

Bhakti Vankhde
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views1 page

CNN Project Cat - Dog - Ipynb - Colab

CNN RNN AI

Uploaded by

Bhakti Vankhde
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

6/27/24, 10:35 AM CNN Project Cat_Dog.

ipynb - Colab

1 import tensorflow as tf
2 from tensorflow.keras.models import Sequential
3 from tensorflow.keras.layers import Conv2D, MaxPooling2D, Flatten, Dense, Dropout
4 from tensorflow.keras.preprocessing.image import ImageDataGenerator
5 from tensorflow.keras.callbacks import ModelCheckpoint
6
7 # Ensure TensorFlow uses a GPU if available
8 print("Num GPUs Available: ", len(tf.config.experimental.list_physical_devices('GPU')))
9

Num GPUs Available: 0

1 # Data generators for loading and augmenting images


2 train_datagen = ImageDataGenerator(
3 rescale=1./255,
4 shear_range=0.2,
5 zoom_range=0.2,
6 horizontal_flip=True
7 )
8
9 test_datagen = ImageDataGenerator(rescale=1./255)
10
11 # --------------------------------------------------------------------------------
12
13 training_set = train_datagen.flow_from_directory(
14 'dataset/training_set',
15 target_size=(64, 64),
16 batch_size=32,
17 class_mode='binary'
18 )
19
20 test_set = test_datagen.flow_from_directory(
21 'dataset/test_set',
22 target_size=(64, 64),
23 batch_size=32,
24 class_mode='binary'
25 )
26

https://colab.research.google.com/drive/1_zHYIMJQTErgo_YxcM_xyTZw6voZENs5#printMode=true 1/1

You might also like