├── README.md ├── model_img.png ├── model_improved.h5 ├── .gitignore └── .gitignore ├── LICENSE └── illumination_mask.ipynb /README.md: -------------------------------------------------------------------------------- 1 | # Low Light Enhancer 2 | -------------------------------------------------------------------------------- /model_img.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ksdkamesh99/ReANet/HEAD/model_img.png -------------------------------------------------------------------------------- /model_improved.h5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ksdkamesh99/ReANet/HEAD/model_improved.h5 -------------------------------------------------------------------------------- /.gitignore/.gitignore: -------------------------------------------------------------------------------- 1 | !Build/ 2 | .last_cover_stats 3 | /META.yml 4 | /META.json 5 | /MYMETA.* 6 | *.o 7 | *.pm.tdy 8 | *.bs 9 | 10 | # Devel::Cover 11 | cover_db/ 12 | 13 | # Devel::NYTProf 14 | nytprof.out 15 | 16 | # Dizt::Zilla 17 | /.build/ 18 | 19 | # Module::Build 20 | _build/ 21 | Build 22 | Build.bat 23 | 24 | # Module::Install 25 | inc/ 26 | 27 | # ExtUtils::MakeMaker 28 | /blib/ 29 | /_eumm/ 30 | /*.gz 31 | /Makefile 32 | /Makefile.old 33 | /MANIFEST.bak 34 | /pm_to_blib 35 | /*.zip 36 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Kota Sai Durga Kamesh 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /illumination_mask.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "nbformat": 4, 3 | "nbformat_minor": 0, 4 | "metadata": { 5 | "colab": { 6 | "name": "illumination_mask.ipynb", 7 | "provenance": [], 8 | "mount_file_id": "1HicDJabC0xM8ihJjGDEK8NLIcWrq9hkk", 9 | "authorship_tag": "ABX9TyPyZuSYDYRmbTCQelfRQ2IK", 10 | "include_colab_link": true 11 | }, 12 | "kernelspec": { 13 | "name": "python3", 14 | "display_name": "Python 3" 15 | }, 16 | "accelerator": "GPU" 17 | }, 18 | "cells": [ 19 | { 20 | "cell_type": "markdown", 21 | "metadata": { 22 | "id": "view-in-github", 23 | "colab_type": "text" 24 | }, 25 | "source": [ 26 | "\"Open" 27 | ] 28 | }, 29 | { 30 | "cell_type": "code", 31 | "metadata": { 32 | "id": "a_YnKk4fWmVm", 33 | "outputId": "dc9b295a-240e-4e95-babb-d93f303995f1", 34 | "colab": { 35 | "base_uri": "https://localhost:8080/", 36 | "height": 34 37 | } 38 | }, 39 | "source": [ 40 | "cd /content/drive/My Drive/LowLightEnhancement" 41 | ], 42 | "execution_count": 10, 43 | "outputs": [ 44 | { 45 | "output_type": "stream", 46 | "text": [ 47 | "/content/drive/My Drive/LowLightEnhancement\n" 48 | ], 49 | "name": "stdout" 50 | } 51 | ] 52 | }, 53 | { 54 | "cell_type": "code", 55 | "metadata": { 56 | "id": "vpHqtxxCV2pg" 57 | }, 58 | "source": [ 59 | "import tensorflow as tf\n", 60 | "import numpy as np\n", 61 | "from PIL import Image" 62 | ], 63 | "execution_count": 11, 64 | "outputs": [] 65 | }, 66 | { 67 | "cell_type": "code", 68 | "metadata": { 69 | "id": "5GKNxTenWMe9" 70 | }, 71 | "source": [ 72 | "img_high=np.load(\"image_high.npy\")" 73 | ], 74 | "execution_count": 12, 75 | "outputs": [] 76 | }, 77 | { 78 | "cell_type": "code", 79 | "metadata": { 80 | "id": "QK5SsO8AWwrF" 81 | }, 82 | "source": [ 83 | "img_low=np.load(\"image_low.npy\")" 84 | ], 85 | "execution_count": 13, 86 | "outputs": [] 87 | }, 88 | { 89 | "cell_type": "code", 90 | "metadata": { 91 | "id": "tM8PD-nLW2V8", 92 | "outputId": "f1ce798d-853c-4762-b173-7801a0e56d8d", 93 | "colab": { 94 | "base_uri": "https://localhost:8080/", 95 | "height": 34 96 | } 97 | }, 98 | "source": [ 99 | "img_high.shape" 100 | ], 101 | "execution_count": 14, 102 | "outputs": [ 103 | { 104 | "output_type": "execute_result", 105 | "data": { 106 | "text/plain": [ 107 | "(1485, 150, 150, 3)" 108 | ] 109 | }, 110 | "metadata": { 111 | "tags": [] 112 | }, 113 | "execution_count": 14 114 | } 115 | ] 116 | }, 117 | { 118 | "cell_type": "code", 119 | "metadata": { 120 | "id": "Fp6MQbewW6yg" 121 | }, 122 | "source": [ 123 | "top_inp=tf.keras.layers.Input(shape=(150,150,3))\n", 124 | "top=tf.keras.layers.Conv2D(64,kernel_size=(3,3),input_shape=(150,150,3),activation='relu')(top_inp)\n", 125 | "top=tf.keras.layers.Conv2D(64,kernel_size=(3,3),activation='relu')(top)" 126 | ], 127 | "execution_count": 19, 128 | "outputs": [] 129 | }, 130 | { 131 | "cell_type": "code", 132 | "metadata": { 133 | "id": "WFrTH7Voeoa1" 134 | }, 135 | "source": [ 136 | "bottom_inp=tf.keras.layers.Input(shape=(150,150,3))\n", 137 | "bottom_resize=tf.keras.layers.Lambda( \n", 138 | " lambda image: tf.compat.v1.image.resize_nearest_neighbor( \n", 139 | " image, \n", 140 | " (224, 224)\n", 141 | " )\n", 142 | ")(bottom_inp)\n" 143 | ], 144 | "execution_count": 28, 145 | "outputs": [] 146 | }, 147 | { 148 | "cell_type": "code", 149 | "metadata": { 150 | "id": "wFYVu3v5euM0" 151 | }, 152 | "source": [ 153 | "bottom=tf.keras.layers.Conv2D(64,kernel_size=(3,3),input_shape=(224,224,3),activation='relu')(bottom_resize)\n", 154 | "bottom=tf.keras.layers.Conv2D(64,kernel_size=(3,3),activation='relu')(bottom)\n", 155 | "bottom=tf.keras.layers.Conv2D(64,kernel_size=(3,3),activation='relu')(bottom)\n", 156 | "bottom=tf.keras.layers.Lambda( \n", 157 | " lambda image: tf.compat.v1.image.resize_nearest_neighbor( \n", 158 | " image, \n", 159 | " (146,146)\n", 160 | " )\n", 161 | ")(bottom)" 162 | ], 163 | "execution_count": 33, 164 | "outputs": [] 165 | }, 166 | { 167 | "cell_type": "code", 168 | "metadata": { 169 | "id": "UysJ2KJ6hYNz", 170 | "outputId": "f6416cda-8a92-4a72-c808-22cdeb005a14", 171 | "colab": { 172 | "base_uri": "https://localhost:8080/", 173 | "height": 34 174 | } 175 | }, 176 | "source": [ 177 | "bottom.get_shape()" 178 | ], 179 | "execution_count": 34, 180 | "outputs": [ 181 | { 182 | "output_type": "execute_result", 183 | "data": { 184 | "text/plain": [ 185 | "TensorShape([None, 146, 146, 64])" 186 | ] 187 | }, 188 | "metadata": { 189 | "tags": [] 190 | }, 191 | "execution_count": 34 192 | } 193 | ] 194 | }, 195 | { 196 | "cell_type": "code", 197 | "metadata": { 198 | "id": "-oBklAH3iLBT", 199 | "outputId": "81972589-7b66-4dde-9bc8-a4b812544798", 200 | "colab": { 201 | "base_uri": "https://localhost:8080/", 202 | "height": 34 203 | } 204 | }, 205 | "source": [ 206 | "top.get_shape()" 207 | ], 208 | "execution_count": 35, 209 | "outputs": [ 210 | { 211 | "output_type": "execute_result", 212 | "data": { 213 | "text/plain": [ 214 | "TensorShape([None, 146, 146, 64])" 215 | ] 216 | }, 217 | "metadata": { 218 | "tags": [] 219 | }, 220 | "execution_count": 35 221 | } 222 | ] 223 | }, 224 | { 225 | "cell_type": "code", 226 | "metadata": { 227 | "id": "xE9AeLqLiNjq" 228 | }, 229 | "source": [ 230 | "merged=tf.keras.layers.concatenate([top,bottom],axis=-1)" 231 | ], 232 | "execution_count": 39, 233 | "outputs": [] 234 | }, 235 | { 236 | "cell_type": "code", 237 | "metadata": { 238 | "id": "8bUMJqgmi06Y" 239 | }, 240 | "source": [ 241 | "merged=tf.keras.layers.Conv2D(64,kernel_size=(3,3),activation='relu')(merged)\n", 242 | "merged=tf.keras.layers.Conv2D(64,kernel_size=(3,3),activation='relu')(merged)\n", 243 | "merged=tf.keras.layers.Conv2D(64,kernel_size=(3,3),activation='relu')(merged)" 244 | ], 245 | "execution_count": 40, 246 | "outputs": [] 247 | }, 248 | { 249 | "cell_type": "code", 250 | "metadata": { 251 | "id": "YfLuYpLSi2Bb", 252 | "outputId": "a9bd2570-f5a0-4668-86a8-894ed5190f87", 253 | "colab": { 254 | "base_uri": "https://localhost:8080/", 255 | "height": 34 256 | } 257 | }, 258 | "source": [ 259 | "merged.get_shape()" 260 | ], 261 | "execution_count": 41, 262 | "outputs": [ 263 | { 264 | "output_type": "execute_result", 265 | "data": { 266 | "text/plain": [ 267 | "TensorShape([None, 140, 140, 64])" 268 | ] 269 | }, 270 | "metadata": { 271 | "tags": [] 272 | }, 273 | "execution_count": 41 274 | } 275 | ] 276 | }, 277 | { 278 | "cell_type": "code", 279 | "metadata": { 280 | "id": "0KISCHprjQ0_" 281 | }, 282 | "source": [ 283 | "model=tf.keras.models.Model(inputs=[top_inp,bottom_inp],outputs=merged)" 284 | ], 285 | "execution_count": 45, 286 | "outputs": [] 287 | }, 288 | { 289 | "cell_type": "code", 290 | "metadata": { 291 | "id": "ZVr8vme_jY6m", 292 | "outputId": "d8900ea5-4ef8-491e-eee6-189eea76a97b", 293 | "colab": { 294 | "base_uri": "https://localhost:8080/", 295 | "height": 605 296 | } 297 | }, 298 | "source": [ 299 | "model.summary()" 300 | ], 301 | "execution_count": 46, 302 | "outputs": [ 303 | { 304 | "output_type": "stream", 305 | "text": [ 306 | "Model: \"functional_1\"\n", 307 | "__________________________________________________________________________________________________\n", 308 | "Layer (type) Output Shape Param # Connected to \n", 309 | "==================================================================================================\n", 310 | "input_8 (InputLayer) [(None, 150, 150, 3) 0 \n", 311 | "__________________________________________________________________________________________________\n", 312 | "lambda_6 (Lambda) (None, 224, 224, 3) 0 input_8[0][0] \n", 313 | "__________________________________________________________________________________________________\n", 314 | "conv2d_9 (Conv2D) (None, 222, 222, 64) 1792 lambda_6[0][0] \n", 315 | "__________________________________________________________________________________________________\n", 316 | "input_1 (InputLayer) [(None, 150, 150, 3) 0 \n", 317 | "__________________________________________________________________________________________________\n", 318 | "conv2d_10 (Conv2D) (None, 220, 220, 64) 36928 conv2d_9[0][0] \n", 319 | "__________________________________________________________________________________________________\n", 320 | "conv2d_3 (Conv2D) (None, 148, 148, 64) 1792 input_1[0][0] \n", 321 | "__________________________________________________________________________________________________\n", 322 | "conv2d_11 (Conv2D) (None, 218, 218, 64) 36928 conv2d_10[0][0] \n", 323 | "__________________________________________________________________________________________________\n", 324 | "conv2d_4 (Conv2D) (None, 146, 146, 64) 36928 conv2d_3[0][0] \n", 325 | "__________________________________________________________________________________________________\n", 326 | "lambda_7 (Lambda) (None, 146, 146, 64) 0 conv2d_11[0][0] \n", 327 | "__________________________________________________________________________________________________\n", 328 | "concatenate_1 (Concatenate) (None, 146, 146, 128 0 conv2d_4[0][0] \n", 329 | " lambda_7[0][0] \n", 330 | "__________________________________________________________________________________________________\n", 331 | "conv2d_13 (Conv2D) (None, 144, 144, 64) 73792 concatenate_1[0][0] \n", 332 | "__________________________________________________________________________________________________\n", 333 | "conv2d_14 (Conv2D) (None, 142, 142, 64) 36928 conv2d_13[0][0] \n", 334 | "__________________________________________________________________________________________________\n", 335 | "conv2d_15 (Conv2D) (None, 140, 140, 64) 36928 conv2d_14[0][0] \n", 336 | "==================================================================================================\n", 337 | "Total params: 262,016\n", 338 | "Trainable params: 262,016\n", 339 | "Non-trainable params: 0\n", 340 | "__________________________________________________________________________________________________\n" 341 | ], 342 | "name": "stdout" 343 | } 344 | ] 345 | }, 346 | { 347 | "cell_type": "code", 348 | "metadata": { 349 | "id": "WqrZuRtCkT5E" 350 | }, 351 | "source": [ 352 | "" 353 | ], 354 | "execution_count": null, 355 | "outputs": [] 356 | } 357 | ] 358 | } --------------------------------------------------------------------------------