<h1 style="text-align: center; font-family: Verdana; font-size: 32px; font-style: normal; font-weight: bold; text-decoration: none; text-transform: none; font-variant: small-caps; letter-spacing: 3px; color: #468282; background-color: #ffffff;">Tensorflow - Help Protect the Great Barrier Reef</h1>
<h2 style="text-align: center; font-family: Verdana; font-size: 24px; font-style: normal; font-weight: bold; text-decoration: underline; text-transform: none; letter-spacing: 2px; color: navy; background-color: #ffffff;">Look-sea: Underwater img enhancement</h2>

<p align="center">
    <img src="https://i.imgur.com/tTOe7cV.png">

# ๐Ÿ“Œ**Introduction:**
<!-- <h1 style="font-family: times-new-roman">๐Ÿ“ŒIntroduction</h1> -->
> <p style="font-family: times-new-roman">Seems like <b>Patrick</b> the Star is lost, and <b>Spongebob, Mr. Krabs, Squidward, and the others</b> need our help to find him. To help them out <b>Kaggle</b> is also trying their best and has put together a very informative dataset the dataset is created based on the places where Patrick most certainly be going, and we need to take the help of AI and computer vision and perform Object detection to find him from that dataset. We still don't know whether Patrick is lost or has left the city because of the last night's argument between him and Spongebob. Well, this will stay as a mystery until we find Patrik. Spongebob, Mr. Krabs, Squidward, and Sandy are all very concerned and doing their best to find Patrick. So let's do our best too, and get Patrick back to his friends.</p>

# ๐Ÿ“‘ **About the Notebook:**
> <p style="font-family: times-new-roman">As per the Discussion thread I posted earlier, I said that I will post the results. So, to do that Im creating this NB. The discussion thred is listed just right below. After playing with data for a bit it was clear that the images were extreamly hezzy because of the thickness of the water, and most of the data are colored in greenish blue. After seeing a Disussion thread on this, I started searching some techniques for underwater image enhancement. After sometime, I stumbled upon this repo which talks about some techiques for Underwater color restoration and color enhancement, there were total 8 methods for image color Enhancement.Don't know how important Color Restoration would be [please let me know if you think color restoration is also important] but Image Enhancement would be very much required. The mentioned techniques are,</p>

> - [8 Methods on Underwater Image Enhancement and Color Restoration, With Code](https://www.kaggle.com/c/tensorflow-great-barrier-reef/discussion/291063)

> ## โญ• **Underwater Image Enhancement**
> > - **CLAHE**: Contrast limited adaptive histogram equalization (1994)
> > - **Fusion-Matlab**: Enhancing underwater images and videos by fusion (2012)
> > - **GC**: Gamma Correction
> > - **HE**: Image enhancement by histogram transformation (2011)
> > - **ICM**: Underwater Image Enhancement Using an Integrated Colour Model (2007)
> > - **UCM**: Enhancing the low-quality images using Unsupervised Colour Correction Method (2010)
> > - **RayleighDistribution**: Underwater image quality enhancement through composition of dual-intensity images and Rayleigh-stretching (2014)
> > - **RGHS**: Shallow-Water Image Enhancement Using Relative Global Histogram Stretching Based on Adaptive Parameter Acquisition (2018)

> > <p style="font-family: times-new-roman"> From these 8 methods I was able to perform, 4 and 3 of them are implemented in two different ways, one is done using the repo's code and the other is implemetnted by me. Results are good but not too good. Because there are papers like <b>sea-thru</b>, <b>FUnIE-GAN</b> and <b>Water-GAN</b> which yields much better results. Check about the GANs <a style="font-family: times-new-roman" href="https://github.com/xahidbuffon/FUnIE-GAN">here</a></p>

> ## ๐Ÿ‘€ **Sea-thru**:
> > <p style="font-family: times-new-roman">This is a great paper, not only because of its good results, also the way the problem is tackled. Most of the time people ends up training large model with a huge pile of data for days to get a decent result. but this paper tries to break down the problem to its core components and solves it. This paper has a extensive use of depth map. Itried to find the trained wights but it seems like its not available. the main concept this paper goes like this,</p>

> > - <p style="font-family: times-new-roman"><b><i>As a result of their research, Akkaynak and Treibitz contend that wavelengths of observed colors depend on speed, distance, and the original color of objects. As with the speed of light through water, the source hue is constant. In this case, if we know the color of an object and its distance from us, we can reverse-engineer the formula that produces the observed color.</i></b></p>

> > To know more check out these two links,
> > - Article: [Sea-Thru: Removing Water from Underwater Images](https://towardsdatascience.com/sea-thru-removing-water-from-underwater-images-935288e13f7d)
> >- Paper: [Sea-Thru: A Method for Removing Water From Underwater Images](https://openaccess.thecvf.com/content_CVPR_2019/html/Akkaynak_Sea-Thru_A_Method_for_Removing_Water_From_Underwater_Images_CVPR_2019_paper.html)
> > - Github: https://github.com/hainh/sea-thru
> > - Dataset: http://csms.haifa.ac.il/profiles/tTreibitz/datasets/sea_thru/index.html

> > <p align="center">
    <img width="600" src="https://i.postimg.cc/6qpZCTFK/sea-thru3.jpg">

> ## ๐Ÿงช **Importance of image Pre-processing:**
> > <p style="font-family: times-new-roman"> Image preprocessing in one of the most important part of a Model building pipeline. It helps to improve the quality of your image, we apply different kind of filters and methods to enhance sertain aspect of the image, may be the given image is very blurry, or may be the image in very noisy, or maybe the image size across the data is not similar, or may be the labeled data is not accurate etc. In these cases we need to use Image preprocessing to clean the data. In some cases it also helps by decreasing model training time and increasing model inference speed. One of the incredible image preprocessing that I saw, was the hair removal in the Melanoma Classification comp. </p>

> ## ๐ŸŽ **Main aim of this Notebook:**
> > - <p style="font-family: times-new-roman"> I tried doing EDA for the provided dataset. I plan to dig much dipper and understand the data in a much better way.</p>
> > - <p style="font-family: times-new-roman"> I tried different approaches to get a decent preprocessed image as mentioned above. The best preprocessed Images this Notebook offers are shown below. We will go through all the methods(except few) and then look into the working code. <b>This is certainly not my work, it is taken from <b><a href="https://www.kaggle.com/ipythonx">@M.Innat's</a></b> comment from</p></b>

> > > <li> <a href="https://www.kaggle.com/c/tensorflow-great-barrier-reef/discussion/290584#1599835">Fast underwater image enhancement for Improved Visual Perception [github+Paper]</a></li>

> > > <p align="center">
    <img src="https://i.imgur.com/wc9rY2J.png">

> > > <p align="center">
    <img src="https://i.imgur.com/ho1D0Ye.png">

> > > <p align="center">
    <img src="https://i.imgur.com/pwBNYJr.png">