金子邦彦研究室人工知能Windows で動く人工知能関係 Pythonアプリケーション,オープンソースソフトウエア)idealo/image-super-resolution のインストールと超解像の実行(超解像)(Python,TensorFlow を使用)(Windows 上)

idealo/image-super-resolution のインストールと超解像の実行(超解像)(Python,TensorFlow を使用)(Windows 上)

ISR は超解像の機能を持つソフトウケア

https://idealo.github.io/image-super-resolution/

前準備

Git のインストール(Windows 上)

Gitは,バージョン管理システム.ソースコードの管理や複数人での共同に役立つ.

サイト内の関連ページ

Windows での Git のインストール: 別ページ »で説明している.

関連する外部ページ

Git の公式ページ: https://git-scm.com/

Python のインストール(Windows 上)

サイト内の関連ページ

関連する外部ページ

Python の公式ページ: https://www.python.org/

TensorFlow,Keras のインストール

Windows での TensorFlowKeras のインストール: 別ページ »で説明

(このページで,Build Tools for Visual Studio 2022,NVIDIA ドライバ, NVIDIA CUDA ツールキットNVIDIA cuDNNのインストールも説明している.)

ISR のインストール

  1. Windows で,コマンドプロンプト管理者として実行

    コマンドプロンプトを管理者として実行: 別ページ »で説明

  2. ISR のインストール

    ※ 「 python -m pip install ...」は,Python パッケージをインストールするためのコマンド.

    python -m pip install cython pyyaml
    git clone https://github.com/idealo/image-super-resolution
    cd image-super-resolution
    python setup.py install
    
  3. 画像ファイル a.png を準備

    [image]
  4. 動作確認のため,Python プログラムを実行する

    Python プログラムの実行: 別ページ »で説明

    Python のまとめ: 別ページ »にまとめ

    https://github.com/idealo/image-super-resolutionで公開されているプログラムを書き替えて使用.

    import numpy as np
    from PIL import Image
    
    img = Image.open('a.png')
    lr_img = np.array(img)
    
    from ISR.models import RDN
    
    rdn = RDN(weights='psnr-small')
    sr_img = rdn.predict(lr_img, by_patch_of_size=50)
    result = Image.fromarray(sr_img)
    result.save('result.png')
    

    [image]
  5. 実行の結果,result.png ができる.

    結果を確認.