<jupyter_start><jupyter_text>**Loading the LFW Dataset**The LFW dataset is loaded onto the system<jupyter_code>!pip install Qkeras

from qkeras import *
import os
import pathlib
import matplotlib.pyplot as plt
import numpy as np
from tensorflow.keras.layers.experimental import preprocessing
from tensorflow.keras import layers
from tensorflow.keras import models
from IPython import display
from keras.layers import *
data_dir = pathlib.Path('data/lfw')
if not data_dir.exists():
  tf.keras.utils.get_file(
      'lfw.tgz',
      origin="http://vis-www.cs.umass.edu/lfw/lfw.tgz",
      extract=True,
      cache_dir='.', cache_subdir='data')
names = np.array(tf.io.gfile.listdir(str(data_dir)))
names = names[names != 'README.md']
print('Names:', names)
filenames = tf.io.gfile.glob(str(data_dir) + '/*/*')
filenames = tf.random.shuffle(filenames)
num_samples = len(filenames)
print('Number of total examples:', num_samples)
print('Number of examples per label:',
      len(tf.io.gfile.listdir(str(data_dir/names[1]))))
print('Example file tensor:', filenames[0])
train_files = filenames[:10587]
val_files = filenames[10587: 10587 + 1323]
test_files = filenames[11910:]

print('Training set size', len(train_files))
print('Validation set size', len(val_files))
print('Test set size', len(test_files))


import matplotlib.image as mpimg
stringname= str(test_files[-1])
stringpath = (stringname[12:-26])
plt.imshow(mpimg.imread(stringpath))
fig = plt.gcf()
size = fig.get_size_inches()*fig.dpi # size in pixels
print(size)
import cv2
from google.colab.patches import cv2_imshow


img = cv2.imread(stringpath)
res = cv2.resize(img, dsize=(128, 128), interpolation=cv2.INTER_LINEAR)
print((res))
cv2_imshow(res)
gray_image = cv2.cvtColor(res, cv2.COLOR_BGR2GRAY)
 
cv2_imshow(gray_image)
def preprocess_image(image_path):
  stringpath = (stringname[12:-26])
  plt.imshow(mpimg.imread(stringpath))
  img = cv2.imread(stringpath)
  res = cv2.resize(img, dsize=(128, 128), interpolation=cv2.INTER_LINEAR)
  cv2_imshow(res)
  gray_image = cv2.cvtColor(res, cv2.COLOR_BGR2GRAY)
 
  cv2_imshow(gray_image)
  return gray_image


import shutil
for i in range(len(train_files)):
  path=str(train_files[i])
  print(path)
  shutil.copy('/Training Dataset/face',path[12:-26])<jupyter_output>tf.Tensor(b'data/lfw/Frances_Fisher/Frances_Fisher_0002.jpg', shape=(), dtype=string)
{'fraction_non_alphanumeric': 0.13807708598051674, 'fraction_numerical': 0.030919102075391783, 'mean_word_length': 6.008902077151335, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 1, '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': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '10431', 'license': 'Apache-2.0', 'n_tokens_mistral': 930, 'n_tokens_neox': 878, 'n_words': 173, 'path': 'Welcome_To_Colaboratory.ipynb', 'repo_name': 'pratishtha-bhatia/tutorials', 'size': '2361'}