{"id":25833839,"url":"https://github.com/dimiz51/petsartistgan","last_synced_at":"2026-05-10T16:37:55.895Z","repository":{"id":223775040,"uuid":"759515460","full_name":"dimiz51/PetsArtistGAN","owner":"dimiz51","description":"PetsArtistGAN is a deep learning project that focuses on generating artistic renditions of pet images using Generative Adversarial Networks (GANs). This repository contains the code for training and evaluating the PetsArtistGAN model.","archived":false,"fork":false,"pushed_at":"2024-02-25T19:28:46.000Z","size":1505,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-22T18:40:26.828Z","etag":null,"topics":["computer-vision","gan","generative-ai","keras"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dimiz51.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-18T19:51:16.000Z","updated_at":"2024-04-28T19:24:10.000Z","dependencies_parsed_at":"2024-02-22T18:28:04.170Z","dependency_job_id":"14946e4a-3f1f-4c97-a405-c8d1f82b6612","html_url":"https://github.com/dimiz51/PetsArtistGAN","commit_stats":null,"previous_names":["dimiz51/petsgan","dimiz51/petsartistgan"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dimiz51/PetsArtistGAN","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimiz51%2FPetsArtistGAN","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimiz51%2FPetsArtistGAN/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimiz51%2FPetsArtistGAN/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimiz51%2FPetsArtistGAN/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dimiz51","download_url":"https://codeload.github.com/dimiz51/PetsArtistGAN/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimiz51%2FPetsArtistGAN/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32864082,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-10T13:40:02.631Z","status":"ssl_error","status_checked_at":"2026-05-10T13:40:02.145Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["computer-vision","gan","generative-ai","keras"],"created_at":"2025-02-28T23:32:23.327Z","updated_at":"2026-05-10T16:37:55.876Z","avatar_url":"https://github.com/dimiz51.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PetsArtistGAN: Generating Art-Influenced Pet Portraits with CycleGAN\nThis Deep Learning project utilizes the CycleGAN to produce captivating pet portraits influenced by various artistic styles from various different eras. By leveraging the power of generative adversarial networks (GANs), this generative Vision model transforms ordinary pet images into visually striking compositions reminiscent of renowned art movements, allowing pet owners to create simple images of their pets into canvas-like portraits. \n\nAs training the model is quite computationally expensive, currently only the pre-training of the model on all styles present in the art styles dataset(link below) and the Oxford pets dataset was conducted. However, a next step would be to fine-tune this model on a smaller dataset of pet/art images coming from a single style or artist.\n\n\n# PetsArtistGAN Model Architecture\n\nThe architecture of the PetsArtistGAN model consists of two generators and two discriminators, implemented using TensorFlow/Keras. Below is a summary of the model's layers and parameters:\n\n| **Layer (type)**          | **Output Shape**     | **Param #**    |\n|---------------------------|----------------------|----------------|\n| Generator_Pet2Art (Functional)| (None, 256, 256, 3) | 54,414,979     |\n| Generator_Art2Pet (Functional)| (None, 256, 256, 3) | 54,414,979     |\n| Discriminator_pet (Functional)| (None, 30, 30, 1)    | 2,765,569      |\n| Discriminator_art (Functional)| (None, 30, 30, 1)    | 2,765,569      |\n\n**Total params**: 114,361,096 (436.25 MB) \\\n**Trainable params**: 114,361,096 (436.25 MB) \\\n**Non-trainable params**: 0 (0.00 Byte)\n\nThe model architecture includes two generators responsible for transforming pet images into art-styled pet images and vice versa. Additionally, there are two discriminators for distinguishing between real and generated images in both the pet and art domains. The total number of parameters in the model is 114,361,096, with all parameters being trainable.\n\n# Scripts\n\n- code/gets_pets_ds.py: Downloads and save the OxfordPets dataset for processing.\n\n- code/model.py: Module containing the PetsArtistGAN model code.\n\n- code/test_inference.py: Containts inference code to test a trained model on a jpg image as:\n```\npython ./code/test_inference.py --model \u003cYOUR_MODEL_DIR\u003e --input-image \u003cJPG_IMAGE\u003e --save-gen (Optional flag to save the generated image)\n```\n\n- code/lr_strategy.py: Helper script just providing a visualization and explanation or the lr strategy used. Inspired by the original CycleGAN paper.\n\n- code/train.py: Script containing training code.\n\n# Notebooks\n- art_dataset.ipynb: Jupyter Notebook containing all the art styles dataset pre-processing/exploration code. Used to generate the train/val splits for the art styles dataset.\n- google_collab/PetsGAN.ipynb: Jupyter Notebook to train the model on Google Collab\n\n# Datasets\nIn order to create the training and validation sets to train our PetsArtist\nmodel from scratch, run follow the steps below.\n\n### Step 1: Download and generate the Oxford Pets dataset from Tensorflow-Datasets\n```\npython ./code/get_pets_ds.py\n```\n\n### Step 2: Create the Art styles dataset as you see fit:\nYou can use the dataset generator provided in *./code/art_dataset.ipynb* to create the art styles dataset after downloading it from Kaggle.\n\n**Art dataset source**: https://www.kaggle.com/datasets/ikarus777/best-artworks-of-all-time\n\n\n### Step 3: Merge the datasets and prepare the PetsGAN_train dataset:\n\n1. **Create the New Dataset Directory:**\n   ```bash\n   mkdir datasets/PetsGAN_train\n   mkdir datasets/PetsGAN_train/art\n   mkdir datasets/PetsGAN_train/pets\n   ```\n\n2. **Copy art dataset images:**\n   ```bash \n   cp -r datasets/art_dataset/train/* datasets/PetsGAN_train/art/\n   ```\n\n3. **Copy pet dataset images:**\n   ```bash\n   cp -r datasets/oxford_pets/train/*/* datasets/PetsGAN_train/pets/\n   ```\n\nNow your newly created training dataset should look like this:\n\n```\ndatasets/PetsGAN_train/ \n├── art_dataset \n│   └── train \n│       ├── art_image1.jpg\n│       ├── art_image2.jpg \n│       └── ... \n└── oxford_pets \n    └─ train \n        ├── Abyssinian \n        │   ├── Abyssinian_1.jpg \n        │   ├── Abyssinian_2.jpg \n        │   └── ... \n        ├── Bengal \n        │   ├── Bengal_1.jpg \n        │   ├── Bengal_2.jpg \n        │   └── ... \n        ├── ... \n\n```\n4. **Create the testing and validation sets**\n- Testing set should contain images only from the pet domain as we will\nbe evaluating the quality of the generated images against the original ones.\n```bash \nmkdir datasets/PetsGAN_test\ncp -r datasets/oxford_pets/test/*/* datasets/PetsGAN_test/\n```\n- For validation set we will be using the remaining images\n```bash \nmkdir datasets/PetsGAN_validation\nmkdir datasets/PetsGAN_validation/art\nmkdir datasets/PetsGAN_validation/pets\ncp -r datasets/art_dataset/validation/* datasets/PetsGAN_validation/art/\ncp -r datasets/oxford_pets/validation/*/* datasets/PetsGAN_validation/pets/\n```\n\n\n# Some results\nThese results were made with a model trained on the full PetsGAN_train dataset for 70 epochs with a batch size of 16 and a constant lr of 2e-4.\n\n\n![Sample 1](sample_results/3.png)\n![Sample 2](sample_results/1.png)\n![Sample 3](sample_results/2.png)\n\n\n# References \n1. [Unpaired Image-to-Image Translation using Cycle-Consistent Adversarial Networks](https://arxiv.org/abs/1703.10593) (Original CycleGAN paper)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdimiz51%2Fpetsartistgan","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdimiz51%2Fpetsartistgan","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdimiz51%2Fpetsartistgan/lists"}