Skip to content

SdAswin/tryingnew-

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

tryingnew-

#wanna develop something from existing import tensorflow as tf from tensorflow.keras.applications import ResNet50 from tensorflow.keras.datasets import cifar10 from tensorflow.keras.preprocessing.image import ImageDataGenerator from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Dense, GlobalAveragePooling2D

Load and preprocess data

(x_train, y_train), (x_test, y_test) = cifar10.load_data() x_train, x_test = x_train / 255.0, x_test / 255.0

Define the model

base_model = ResNet50(weights='imagenet', include_top=False, input_shape=(32, 32, 3)) x = base_model.output x = GlobalAveragePooling2D()(x) x = Dense(1024, activation='relu')(x) predictions = Dense(10, activation='softmax')(x)

model = tf.keras.models.Model(inputs=base_model.input, outputs=predictions) for layer in base_model.layers: layer.trainable = False

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

Train the model

model.fit(x_train, y_train, epochs=10, validation_split=0.2) model.evaluate(x_test, y_test)

About

wanna develop something from existing

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published