{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.10.12","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"none","dataSources":[{"sourceId":21755,"databundleVersionId":1475600,"sourceType":"competition"}],"dockerImageVersionId":30558,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"import os\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n    for filename in filenames:\n        print(os.path.join(dirname, filename))","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","scrolled":true,"execution":{"iopub.status.busy":"2024-01-11T11:29:32.090779Z","iopub.execute_input":"2024-01-11T11:29:32.091291Z","iopub.status.idle":"2024-01-11T11:29:38.130015Z","shell.execute_reply.started":"2024-01-11T11:29:32.091246Z","shell.execute_reply":"2024-01-11T11:29:38.128967Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import numpy as np \nimport pandas as pd \nfrom glob import glob\nimport cv2 as cv\nfrom glob import glob\nimport matplotlib.pyplot as plt","metadata":{"execution":{"iopub.status.busy":"2024-01-11T11:29:38.132199Z","iopub.execute_input":"2024-01-11T11:29:38.132524Z","iopub.status.idle":"2024-01-11T11:29:38.791033Z","shell.execute_reply.started":"2024-01-11T11:29:38.132496Z","shell.execute_reply":"2024-01-11T11:29:38.790080Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import tensorflow as tf\nfrom tensorflow.data import TFRecordDataset","metadata":{"execution":{"iopub.status.busy":"2024-01-11T11:31:45.096804Z","iopub.execute_input":"2024-01-11T11:31:45.097175Z","iopub.status.idle":"2024-01-11T11:31:45.102578Z","shell.execute_reply.started":"2024-01-11T11:31:45.097146Z","shell.execute_reply":"2024-01-11T11:31:45.101316Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<h1>Reading Data</h1>","metadata":{}},{"cell_type":"code","source":"general_path='../input/gan-getting-started'\nimage_path_list=glob(general_path+\"/*\")\nimage_path_list","metadata":{"execution":{"iopub.status.busy":"2024-01-11T11:38:05.062111Z","iopub.execute_input":"2024-01-11T11:38:05.062540Z","iopub.status.idle":"2024-01-11T11:38:05.072515Z","shell.execute_reply.started":"2024-01-11T11:38:05.062505Z","shell.execute_reply":"2024-01-11T11:38:05.071185Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def read_images(path: str, name:str):\n    \n    for image in path:\n        if name in list(os.path.split(image))[1]:\n            image_path=glob(os.path.dirname(image)+\"/\"+name+\"_jpg\"+\"/*.jpg\")\n            record_path=glob(os.path.dirname(image)+\"/\"+name+\"_tfrec\"+\"/*.tfrec\")\n            \n    return image_path,record_path\n            \n\ndef convert_to_images(*args):\n    \n    monet_images=[cv.imread(image) for image in args[0]]\n    photos_=[cv.imread(image) for image in args[1]]\n    return monet_images,photos_","metadata":{"execution":{"iopub.status.busy":"2024-01-11T12:43:40.183022Z","iopub.execute_input":"2024-01-11T12:43:40.184143Z","iopub.status.idle":"2024-01-11T12:43:40.191446Z","shell.execute_reply.started":"2024-01-11T12:43:40.184103Z","shell.execute_reply":"2024-01-11T12:43:40.190515Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"monet_images,monet_records=read_images(image_path_list,\"monet\")\nphotos_path,photos_records=read_images(image_path_list,\"photo\")\n\nmon_img,photo_=convert_to_images(monet_images,photos_path)","metadata":{"execution":{"iopub.status.busy":"2024-01-11T12:44:17.398773Z","iopub.execute_input":"2024-01-11T12:44:17.399461Z","iopub.status.idle":"2024-01-11T12:45:16.032622Z","shell.execute_reply.started":"2024-01-11T12:44:17.399427Z","shell.execute_reply":"2024-01-11T12:45:16.031053Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{"trusted":true},"execution_count":null,"outputs":[]}]}