<jupyter_start><jupyter_text>***VGG16***<jupyter_code>import keras
from keras.layers import Input, Lambda, Dense, Flatten
from keras.models import Model
from keras.applications.vgg16 import VGG16
from keras.applications.vgg16 import preprocess_input
from keras.preprocessing import image
from keras.preprocessing.image import ImageDataGenerator
from keras.models import Sequential
import numpy as np
from glob import glob
import matplotlib.pyplot as plt

from sklearn.model_selection import train_test_split
import numpy as np
from sklearn.model_selection import train_test_split
training_data = np.load('/content/drive/MyDrive/####Online_Journal/Total_Left_data_100_update.npy', allow_pickle=True)
x_train=np.array([i[0] for i in training_data])
y_train=np.array([i[1] for i in training_data])
x_train=x_train/255

testing_data = np.load('/content/drive/MyDrive/####Online_Journal/Total_Right_data_100_update.npy', allow_pickle=True)
x_test=np.array([i[0] for i in testing_data])
y_test=np.array([i[1] for i in testing_data])
x_test=x_test/255
x_train = np.concatenate((x_train, x_test))
y_train = np.concatenate((y_train, y_test))
# Splitting the dataset into the Training set and Test set
x_train, x_test, y_train, y_test = train_test_split(x_train, y_train, test_size = 0.25, random_state = 0)
num_classes = 2
image_input = Input(shape=(224, 224, 3))
model = VGG16(input_tensor=image_input, include_top=True, weights='imagenet')
#model.summary()

for layer in model.layers:
  layer.trainable = False
  #print(layer ,layer.trainable)

out = Dense(2, activation='softmax', name='output')(model.get_layer('fc2').output)


vgg_model = Model(image_input, out)

vgg_model.summary()
vgg_model.compile(optimizer=keras.optimizers.Adam(learning_rate=0.0001), loss='categorical_crossentropy', metrics=['accuracy']) #sparse_categorical_crossentropy
history = vgg_model.fit(x_train, y_train, epochs=150, validation_data=(x_test, y_test), batch_size = 64)
import pandas as pd
Model_History = pd.DataFrame(history.history) 

hist_csv_file = '/content/drive/MyDrive/####Online_Journal/history_VGG16.csv'
with open(hist_csv_file, mode='w') as f:
    Model_History.to_csv(f)
############################################## VGG19 #######################################################<jupyter_output><empty_output><jupyter_text>***VGG19***<jupyter_code>import keras
from keras.layers import Input, Lambda, Dense, Flatten
from keras.models import Model
from keras.applications.vgg19 import VGG19
from keras.applications.vgg19 import preprocess_input
from keras.preprocessing import image
from keras.models import Sequential
import numpy as np
import matplotlib.pyplot as plt

from sklearn.model_selection import train_test_split
num_classes = 2
image_input = Input(shape=(224, 224, 3))
model = VGG19(input_tensor=image_input, include_top=True, weights='imagenet')
#model.summary()

for layer in model.layers:
  layer.trainable = False
  #print(layer ,layer.trainable)

out = Dense(2, activation='softmax', name='output')(model.get_layer('fc2').output)
vgg_model19 = Model(image_input, out)

vgg_model19.summary()
vgg_model19.compile(optimizer=keras.optimizers.Adam(learning_rate=0.0001), loss='categorical_crossentropy', metrics=['accuracy']) #sparse_categorical_crossentropy
history = vgg_model19.fit(x_train, y_train, epochs=150, validation_data=(x_test, y_test), batch_size = 64)
import pandas as pd
Model_History = pd.DataFrame(history.history) 

hist_csv_file = '/content/drive/MyDrive/####Online_Journal/history_VGG19.csv'
with open(hist_csv_file, mode='w') as f:
    Model_History.to_csv(f)<jupyter_output><empty_output><jupyter_text>***InceptionResNetV2***<jupyter_code>from keras.applications.inception_resnet_v2 import InceptionResNetV2
from keras.applications.inception_resnet_v2 import preprocess_input
num_classes = 2
image_input = Input(shape=(224, 224, 3))
model = InceptionResNetV2(input_tensor=image_input, include_top=True, weights='imagenet')
#model.summary()

for layer in model.layers:
  layer.trainable = False
  #print(layer ,layer.trainable)

out = Dense(2, activation='softmax', name='output')(model.get_layer('avg_pool').output)
InceptionResNetV2_1 = Model(image_input, out)

InceptionResNetV2_1.summary()
InceptionResNetV2_1.compile(optimizer=keras.optimizers.Adam(learning_rate=0.0001), loss='categorical_crossentropy', metrics=['accuracy']) #sparse_categorical_crossentropy
history = InceptionResNetV2_1.fit(x_train, y_train, epochs=150, validation_data=(x_test, y_test), batch_size = 64)
import pandas as pd
Model_History = pd.DataFrame(history.history) 

hist_csv_file = '/content/drive/MyDrive/####Online_Journal/history_InceptionResNetV2_1.csv'
with open(hist_csv_file, mode='w') as f:
    Model_History.to_csv(f)
########################################  ResNet50 ###################################################<jupyter_output><empty_output><jupyter_text>***ResNet50***<jupyter_code>from keras.applications.resnet50 import ResNet50
from keras.applications.resnet50 import preprocess_input
num_classes = 2
image_input = Input(shape=(224, 224, 3))
model = ResNet50(input_tensor=image_input, include_top=True, weights='imagenet')
#model.summary()

for layer in model.layers:
  layer.trainable = False
  #print(layer ,layer.trainable)

out = Dense(2, activation='softmax', name='output')(model.get_layer('avg_pool').output)
ResNet50_1 = Model(image_input, out)

ResNet50_1.summary()
ResNet50_1.compile(optimizer=keras.optimizers.Adam(learning_rate=0.0001), loss='categorical_crossentropy', metrics=['accuracy']) #sparse_categorical_crossentropy
history = ResNet50_1.fit(x_train, y_train, epochs=150, validation_data=(x_test, y_test), batch_size = 64)
import pandas as pd
Model_History = pd.DataFrame(history.history) 

hist_csv_file = '/content/drive/MyDrive/####Online_Journal/history_ResNet50_1.csv'
with open(hist_csv_file, mode='w') as f:
    Model_History.to_csv(f)<jupyter_output><empty_output><jupyter_text>***ResNet101***<jupyter_code>##################################### ResNet101 ############################################
#keras.applications.ResNet152
from keras.applications.mobilenet import MobileNet
from keras.applications.mobilenet import preprocess_input
num_classes = 2
image_input = Input(shape=(224, 224, 3))
model = MobileNet(input_tensor=image_input, include_top=True, weights='imagenet')
#model.summary()

for layer in model.layers:
  layer.trainable = False
  #print(layer ,layer.trainable)

out = Dense(2, activation='softmax', name='output')(model.get_layer('reshape_2').output)
MobileNet_1 = Model(image_input, out)

MobileNet_1.summary()
MobileNet_1.compile(optimizer=keras.optimizers.Adam(learning_rate=0.0001), loss='categorical_crossentropy', metrics=['accuracy']) #sparse_categorical_crossentropy
history = MobileNet_1.fit(x_train, y_train, epochs=150, validation_data=(x_test, y_test), batch_size = 64)
import pandas as pd
Model_History = pd.DataFrame(history.history) 

hist_csv_file = '/content/drive/MyDrive/####Online_Journal/history_MobileNet_1.csv'
with open(hist_csv_file, mode='w') as f:
    Model_History.to_csv(f)<jupyter_output><empty_output><jupyter_text>***Xception***<jupyter_code>from keras.applications.xception import Xception
from keras.applications.xception import preprocess_input
num_classes = 2
image_input = Input(shape=(224, 224, 3))
model = Xception(input_tensor=image_input, include_top=True, weights='imagenet')
#model.summary()

for layer in model.layers:
  layer.trainable = False
  #print(layer ,layer.trainable)

out = Dense(2, activation='softmax', name='output')(model.get_layer('avg_pool').output)
Xception_1 = Model(image_input, out)

Xception_1.summary()
Xception_1.compile(optimizer=keras.optimizers.Adam(learning_rate=0.0001), loss='categorical_crossentropy', metrics=['accuracy']) #sparse_categorical_crossentropy
history = Xception_1.fit(x_train, y_train, epochs=150, validation_data=(x_test, y_test), batch_size = 64)
import pandas as pd
Model_History = pd.DataFrame(history.history) 

hist_csv_file = '/content/drive/MyDrive/####Online_Journal/history_Xception_1.csv'
with open(hist_csv_file, mode='w') as f:
    Model_History.to_csv(f)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1509433962264151, 'fraction_numerical': 0.028424405782896348, 'mean_word_length': 8.614840989399294, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, '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': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '596796', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 2967, 'n_tokens_neox': 2785, 'n_words': 504, 'path': 'Diffrent TL Architectures/Six_TL_Architecture_comparison.ipynb', 'repo_name': 'nahidul76edu/Deep-Learning', 'size': '8162'}