[PYTHON] I tried to build a super-resolution method / SRCNN ②

Overview

Continuing from the previous session. It is part2. Click here for the previous link (part1) → https://t.co/CpVUj7CiHo?amp=1 Last time: I tried to build a super-resolution method / SRCNN ① Continued: I tried to build a super-resolution method / SRCNN ③

table of contents

1.First of all 2. PC environment 3. Code description 4. At the end

1.First of all

Super-resolution is a technology that improves the resolution of low-resolution images and moving images, and SRCNN uses deep learning to measure results with higher accuracy than conventional methods. It is the method that was done. (Second time)

The full code is also posted on GitHub, so please check there. https://github.com/morisumori/srcnn_keras

2. PC environment

cpu : intel corei7 8th Gen gpu : NVIDIA GeForce RTX 1080ti os : ubuntu 20.04

3. Code description

As you can see from GitHub, it mainly consists of three codes. ・ Datacreate.py → Data set generation program ・ Model.py → SRCNN program ・ Main.py → Execution program I have created a function with datacreate.py and model.py and executed it with main.py.

__ This time I will explain model.py. __

Description of model.py

model.py



import tensorflow as tf
from tensorflow.python.keras.models import Model
from tensorflow.python.keras.layers import Conv2D, Input

def SRCNN():
    input_shape = Input((None, None, 1))

    conv2d_0 = Conv2D(filters = 64,
                        kernel_size = (9, 9),
                        padding = "same",
                        activation = "relu",
                        )(input_shape)
    conv2d_1 = Conv2D(filters = 32,
                        kernel_size = (1, 1),
                        padding = "same",
                        activation = "relu",
                        )(conv2d_0)
    conv2d_2 = Conv2D(filters = 1,
                        kernel_size = (5, 5),
                        padding = "same",
                        )(conv2d_1)

    model = Model(inputs = input_shape, outputs = [conv2d_2])

    model.summary()

    return model

As expected, it's short.

By the way, when I look at the SRCNN paper, I write that it has such a structure. image.png It has a total of 3 layers. Please read the paper for the details of the model. Link → https://arxiv.org/pdf/1501.00092.pdf

In the code, the number of filters, kernel size, etc. described in the paper are applied as they are, so it seems that copying is fine. I'm building with keras.

I don't really explain about model ...? It's all a Convolution layer. For more information, see keras documentation.

4. At the end

This time I explained the model. The last is the implementation. Last time: I tried to build a super-resolution method / SRCNN ① Continued: I tried to build a super-resolution method / SRCNN ③

If you have any questions or comments, please do not hesitate to contact us!

Recommended Posts

I tried to build a super-resolution method / SRCNN ①
I tried to build a super-resolution method / SRCNN ②
I tried to build a super-resolution method / ESPCN
[Go + Gin] I tried to build a Docker environment
I tried "How to get a method decorated in Python"
I tried to create a linebot (implementation)
I tried to create a linebot (preparation)
I want to build a Python environment
I tried to make a Web API
I tried to debug.
I tried to paste
I tried to build a Mac Python development environment with pythonz + direnv
I tried to make a ○ ✕ game using TensorFlow
I tried to make a "fucking big literary converter"
I tried to create a table only with Django
I tried to draw a route map with Python
I tried to implement a pseudo pachislot in Python
I tried to implement a recommendation system (content-based filtering)
I want to easily build a model-based development environment
I tried to build ML Pipeline with Cloud Composer
I tried to automatically generate a password with Python3
CTF beginner tried to build a problem server (web) [Problem]
I tried to simulate the dollar cost averaging method
I added a function to CPython (build & structure grasp)
I tried to draw a configuration diagram using Diagrams
I tried to learn PredNet
I tried to organize SVM.
I tried to implement PCANet
I tried to reintroduce Linux
I tried to introduce Pylint
I tried to summarize SparseMatrix
I tried to touch jupyter
I tried to implement StarGAN (1)
I tried to build an environment with WSL + Ubuntu + VS Code in a Windows environment
I tried to create a class to search files with Python's Glob method in VBA
I tried to implement a basic Recurrent Neural Network model
I tried the super-resolution algorithm "PULSE" in a Windows environment
I tried to implement a one-dimensional cellular automaton in Python
I tried to automatically create a report with Markov chain
[Markov chain] I tried to read a quote into Python.
I tried to get started with Hy ・ Define a class
I tried to automate [a certain task] using Raspberry Pi
I stumbled when I tried to install Basemap, so a memorandum
I tried to sort a random FizzBuzz column with bubble sort.
I tried to divide with a deep learning language model
I tried to make a simple text editor using PyQt
I tried to build a service that sells machine-learned data at explosive speed with Docker
I tried to implement Deep VQE
I tried to create Quip API
I tried to touch Python (installation)
I tried to implement adversarial validation
I tried to explain Pytorch dataset
I tried Watson Speech to Text
I tried to touch Tesla's API
I tried to implement hierarchical clustering
I tried to organize about MCMC.
I tried to implement Realness GAN
I tried to move the ball
I tried to estimate the interval.
[5th] I tried to make a certain authenticator-like tool with python
I tried to create a server environment that runs on Windows 10