{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.10.13","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":30746,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"markdown","source":"# DTSA5511 - GANs Monet Painting \n\n**Author** - Korkrid Akepanidtaworn, University of Colorado Boulder, Masters in Data Science\n**Date** - August, 20,2024\n\n## Project Goal\n\n- Computer vision has advanced tremendously in recent years and GANs are now capable of mimicking objects in a very convincing way. But creating museum-worthy masterpieces is thought of to be, well, more art than science. So can (data) science, in the form of GANs, trick classifiers into believing you’ve created a true Monet? That’s the challenge you’ll take on!\n- My goal is to build a GAN that generates 7,000 to 10,000 Monet-style images. \n- A GAN consists of at least two neural networks: a generator model and a discriminator model. The generator is a neural network that creates the images. For our competition, you should generate images in the style of Monet. This generator is trained using a discriminator.\n- The two models will work against each other, with the generator trying to trick the discriminator, and the discriminator trying to accurately classify the real vs. generated images.\n- [I’m Something of a Painter Myself | Kaggle](https://www.kaggle.com/competitions/gan-getting-started)\n\n## Dataset Description\n\n**Dataset Structure**\n\nThe dataset is organized into four directories:\n* `monet_tfrec`: Contains Monet paintings in TFRecord format (256x256).\n* `monet_jpg`: Contains Monet paintings in JPEG format (256x256).\n* `photo_tfrec`: Contains photos in TFRecord format (256x256).\n* `photo_jpg`: Contains photos in JPEG format (256x256).\n\n**Data Equivalence**\n\n* `monet_tfrec` and `monet_jpg` directories contain identical Monet painting images.\n* `photo_tfrec` and `photo_jpg` directories contain identical photo images.\n\n**Recommended Data Format**\n\nWhile JPEG images are provided, we strongly recommend using TFRecords as a starting point. Working with TFRecords can be a valuable learning experience for a new data format.\n\n**Dataset Purpose**\n\n* **Monet directories:** Utilize the Monet paintings for training your model.\n* **Photo directories:** Apply a Monet-style transformation to these photos and submit the generated JPEG images in a zip file. A maximum of 10,000 images is allowed.\n\n**Submission Guidelines**\n\n* The submitted images can be entirely generated Monet-style art without relying solely on transformed photos.\n* Explore other GAN architectures like DCGAN for creating Monet-style art from scratch.\n* Consider using the CycleGAN dataset to experiment with different artistic styles.\n\n**File Details**\n\n* `monet_jpg`: 300 Monet paintings (256x256 JPEG)\n* `monet_tfrec`: 300 Monet paintings (256x256 TFRecord)\n* `photo_jpg`: 7028 photos (256x256 JPEG)\n* `photo_tfrec`: 7028 photos (256x256 TFRecord)","metadata":{}},{"cell_type":"code","source":"# Check Python version\n!python --version","metadata":{"execution":{"iopub.status.busy":"2024-08-20T17:50:20.827055Z","iopub.execute_input":"2024-08-20T17:50:20.827884Z","iopub.status.idle":"2024-08-20T17:50:21.987966Z","shell.execute_reply.started":"2024-08-20T17:50:20.827849Z","shell.execute_reply":"2024-08-20T17:50:21.986704Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python\n# For example, here's several helpful packages to load\n\n# Standard libraries\nimport random  # For generating random numbers and shuffling\nimport shutil  # For file operations like copying and moving\n\n# Numerical and data manipulation libraries\nimport numpy as np  # For numerical operations and arrays\nimport pandas as pd  # For data manipulation and analysis\n\n# Image handling and visualization libraries\nimport matplotlib.image as mpimg  # For reading image files\nimport matplotlib.pyplot as plt  # For creating plots and visualizations\nfrom PIL import Image  # For opening and manipulating images\n\n# TensorFlow and Keras libraries\nimport tensorflow as tf  # For building and training machine learning models\nfrom tensorflow import keras  # For high-level Keras API\nfrom tensorflow.keras import layers  # For building neural network layers\n\n# OS and file path utilities\nfrom os import listdir  # For listing files in a directory\nfrom os.path import isfile, join  # For path manipulations and checking file existence","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2024-08-20T17:50:37.483447Z","iopub.execute_input":"2024-08-20T17:50:37.483886Z","iopub.status.idle":"2024-08-20T17:50:37.491536Z","shell.execute_reply.started":"2024-08-20T17:50:37.483855Z","shell.execute_reply":"2024-08-20T17:50:37.490273Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## EDA Procedure","metadata":{}},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## Additional Resources\n\n### Concepts of GANs\n- [Generative Adversarial Networks(GANs): Complete Guide to GANs](https://www.analyticsvidhya.com/blog/2021/10/an-end-to-end-introduction-to-generative-adversarial-networksgans/)\n\n\n### Python Coding\n- [python - Limiting print output - Stack Overflow](https://stackoverflow.com/questions/29321969/limiting-print-output)\n","metadata":{}}]}