├── new.jpg ├── 13.25708991,77.32113037_2.jpg ├── 13.25708991,77.32983037_2.jpg ├── scripts ├── images │ ├── 13.25708991,77.32113037_2.jpg │ └── 13.25708991,77.32113037_3.jpg ├── GANs │ ├── my-approach │ │ └── README.md │ └── README.md └── data_preparation.py └── README.md /new.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/krshrimali/Cloud-Removal-using-GANs/master/new.jpg -------------------------------------------------------------------------------- /13.25708991,77.32113037_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/krshrimali/Cloud-Removal-using-GANs/master/13.25708991,77.32113037_2.jpg -------------------------------------------------------------------------------- /13.25708991,77.32983037_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/krshrimali/Cloud-Removal-using-GANs/master/13.25708991,77.32983037_2.jpg -------------------------------------------------------------------------------- /scripts/images/13.25708991,77.32113037_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/krshrimali/Cloud-Removal-using-GANs/master/scripts/images/13.25708991,77.32113037_2.jpg -------------------------------------------------------------------------------- /scripts/images/13.25708991,77.32113037_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/krshrimali/Cloud-Removal-using-GANs/master/scripts/images/13.25708991,77.32113037_3.jpg -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Cloud-Removal-using-GANs- 2 | 3 | **Note:** This repo has been made public to share how we went through the project. This doesn't intend to act as a solution for the problem statement. Thanks! 4 | 5 | **FarmGuide Project, DL Course IIIT NR** 6 | 7 | ## Progress: 8 | 1. Data Preparation Script - DONE! (krshrimali) 9 | 10 | ## TODO: 11 | 1. First presentation drafting (krutikabapat) 12 | 2. Dataset Downloading, 11.5 GB (ramayan) 13 | 3. Literature Review, reading and presentation (minakshee) 14 | 4. Data preparation (imsrbh, ramayan) 15 | 5. EDA and Data Preprocessing (krshrimali) 16 | -------------------------------------------------------------------------------- /scripts/GANs/my-approach/README.md: -------------------------------------------------------------------------------- 1 | 1. This problem is similar to denoising/edge detection etc. using GANs. Image to Image Translation, because the input and output are both images (and not noise). 2 | 2. It's not a classification problem. And is also supervised learning problem. (**Rethink on this**) 3 | 3. Next step: Check how image to image translation works using GANs, the code should be almost similar. 4 | 5 | **Step 1:** Reading through Pix2Pix Blog 6 | 7 | 1. Good trick: Save the loaded datasets as NumPy Arrays in .npz format. This will save time while loading data during experimentations again and again. NumPy has savez_compressed function, 8 | import using from numpy import savez_compressed 9 | -------------------------------------------------------------------------------- /scripts/GANs/README.md: -------------------------------------------------------------------------------- 1 | ## Solution using GANs 2 | 3 | This is a start to solving the problem using GANs. Here is the expected pipeline: 4 | 5 | 1. Think yourself on how it will proceed. Which type of GANs do we need to use? 6 | 2. Make a shallow code based on what you thought. 7 | 3. Go through the literature review, what has been done before and how close were you to the existing solutions? What are their evaluation metrics? What is SOTA in this task? Make a list. 8 | 4. Implement the existing solutions, and use the augmented data using change in intensity/brightness/blurring/noising etc. Do you see any improvements? 9 | 10 | **Extras** 11 | 12 | 1. Divide the data using technique of detecting IQA (using BRISQUE or something else, maybe Divine or something like Full Reference IQA), or using variance of laplacian measure (calculate the average variance of laplacian for that). Note: 250 images with cloud, and 1250 without cloud. Need heavy data augmentation. Method important than the output - Ojha sir. So don't care about getting more data. 13 | 14 | **Implementation** 15 | 16 | 1. Pix2Pix GANs 17 | -------------------------------------------------------------------------------- /scripts/data_preparation.py: -------------------------------------------------------------------------------- 1 | import cv2 2 | import numpy as np 3 | import matplotlib.pyplot as plt 4 | import os 5 | import sys 6 | import shutil 7 | 8 | class Dataset: 9 | ''' 10 | Dataset class 11 | 12 | This class is for loading dataset and preparation. Aims to make work easier, for dividing images to cloud and non-cloud folders. 13 | 14 | Usage 15 | ============= 16 | ds = Dataset(folder="images/") # Note the compulsory '/' after path 17 | # To show 2 images as samples 18 | ds.show_samples() 19 | # To save images to cloud and non-cloud folder 20 | ds.show() 21 | 22 | Parameters 23 | ============== 24 | 1. folder: (default="images/"), type=str 25 | 26 | Functions 27 | ============== 28 | 1. read_images() 29 | Reads images into a list: self.images 30 | 2. show_samples() 31 | Shows 2 images samples as matplotlib subplot 32 | 3. show() 33 | Shows images one by one, press C/c to save to cloud folder and N/n to save to non-cloud folder. 34 | 35 | TODO 36 | ============== 37 | 1. Make data preparation function 38 | 39 | ''' 40 | def __init__(self, folder="images/"): 41 | self.path = folder 42 | self.files = [x for x in os.listdir(self.path) if x.endswith('.jpg') or x.endswith('.jpeg') or x.endswith('.png')] 43 | self.images = [] 44 | 45 | def read_images(self): 46 | ''' 47 | This function reads images from the folder path, and saves to a list (self.images) 48 | 49 | Parameters 50 | ============== 51 | None 52 | 53 | Returns 54 | ============== 55 | None 56 | ''' 57 | 58 | # Iterate through all the files 59 | for file in self.files: 60 | file = self.path + file 61 | 62 | # Read Image 63 | img = cv2.imread(file, 1) 64 | 65 | if(img is None): 66 | print("Error reading file: {}, skipping...".format(file)) 67 | continue 68 | 69 | # Append to the list 70 | self.images.append(img) 71 | 72 | print("Finished reading {} images".format(len(self.images))) 73 | 74 | def show_samples(self): 75 | ''' 76 | This function shows 2 images as samples using matplotlib subplot. 77 | 78 | Parameters 79 | ============== 80 | None 81 | 82 | Returns 83 | ============== 84 | None 85 | ''' 86 | 87 | # Call read images function 88 | self.read_images() 89 | 90 | # Make a subplot and plot both images 91 | fig, axs = plt.subplots(2) 92 | axs[0].axis("off") 93 | axs[1].axis("off") 94 | axs[0].imshow(cv2.cvtColor(self.images[0], cv2.COLOR_BGR2RGB)) 95 | axs[1].imshow(cv2.cvtColor(self.images[1], cv2.COLOR_BGR2RGB)) 96 | plt.show() 97 | 98 | def show(self): 99 | ''' 100 | Shows all images one by one. 101 | Press c/C to save to cloud folder. 102 | Press n/N to save to non-cloud folder. 103 | 104 | Folders saved to: /cloud and /non-cloud 105 | 106 | For default case: images/cloud and images/non-cloud 107 | ''' 108 | 109 | # Create sub-folders if they don't exist 110 | for folders in ["cloud", "non-cloud"]: 111 | if(os.path.exists(self.path + folders) is False): 112 | os.makedirs(self.path + folders) 113 | 114 | for index, img in enumerate(self.images): 115 | cv2.imshow("Image", img) 116 | k = cv2.waitKey(0) 117 | if(k == ord('C') or k == ord('c')): 118 | shutil.copyfile(self.path + self.files[index], self.path + "cloud/" + self.files[index]) 119 | elif(k == ord('n') or k == ord('N')): 120 | shutil.copyfile(self.path + self.files[index], self.path + "/non-cloud/" + self.files[index]) 121 | cv2.destroyAllWindows() 122 | print("Index: {} finished of {}".format(index+1, len(self.images))) 123 | 124 | if __name__ == "__main__": 125 | ds = Dataset("images/") 126 | ds.show_samples() 127 | ds.show() 128 | --------------------------------------------------------------------------------