From 7c8cc5609f14af308a55843d0055e29192e050e3 Mon Sep 17 00:00:00 2001 From: "Alex J. Champandard" Date: Fri, 11 Nov 2016 00:33:54 +0100 Subject: [PATCH] Add training scripts, they take a while to run! --- README.rst | 4 ++-- scripts/ne1x-photo-repair.sh | 18 ++++++++++++++++++ scripts/ne2x-photo-default.sh | 18 ++++++++++++++++++ scripts/small-1x.sh | 18 ------------------ scripts/small-2x.sh | 18 ------------------ scripts/small-4x.sh | 18 ------------------ 6 files changed, 38 insertions(+), 56 deletions(-) create mode 100644 scripts/ne1x-photo-repair.sh create mode 100644 scripts/ne2x-photo-default.sh delete mode 100644 scripts/small-1x.sh delete mode 100644 scripts/small-2x.sh delete mode 100644 scripts/small-4x.sh diff --git a/README.rst b/README.rst index fc3da2e..63e1773 100644 --- a/README.rst +++ b/README.rst @@ -94,7 +94,7 @@ Pre-trained models are provided in the GitHub releases. Training your own is a The easiest way to get up-and-running is to `install Docker `_. Then, you should be able to download and run the pre-built image using the ``docker`` command line tool. Find out more about the ``alexjc/neural-enhance`` image on its `Docker Hub `_ page. -Here's the simplest way you can call the script using ``docker``, assuming you're familiar with using ``-v` to mount folders you can use this directly to specify files to enhance: +Here's the simplest way you can call the script using ``docker``, assuming you're familiar with using ``-v`` argument to mount folders you can use this directly to specify files to enhance: .. code:: bash @@ -111,7 +111,7 @@ Here's the simplest way you can call the script using ``docker``, assuming you'r # Now run any of the examples above using this alias, without the `.py` extension. enhance --zoom=1 --model=repair images/broken.jpg -**Multiple Images** — To enhance multiple images in a row (faster) from a folder or widlcard specification, make sure to quote the argument to the alias command: +**Multiple Images** — To enhance multiple images in a row (faster) from a folder or wildcard specification, make sure to quote the argument to the alias command: .. code:: bash diff --git a/scripts/ne1x-photo-repair.sh b/scripts/ne1x-photo-repair.sh new file mode 100644 index 0000000..50ef32e --- /dev/null +++ b/scripts/ne1x-photo-repair.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +python3.4 enhance.py \ + --train "$OPEN_IMAGES_PATH/*/*.jpg" --type photo --model repair \ + --epochs=50 --batch-shape=256 --device=gpu1 \ + --generator-downscale=2 --generator-upscale=2 \ + --generator-blocks=8 --generator-filters=128 --generator-residual=0 \ + --perceptual-layer=conv2_2 --smoothness-weight=1e7 --adversary-weight=0.0 \ + --train-noise=2.0 --train-jpeg=30 + +python3.4 enhance.py \ + --train "$OPEN_IMAGES_PATH/*/*.jpg" --type photo --model repair \ + --epochs=500 --batch-shape=240 --device=gpu1 \ + --generator-downscale=2 --generator-upscale=2 \ + --perceptual-layer=conv5_2 --smoothness-weight=5e3 --adversary-weight=5e1 \ + --generator-start=10 --discriminator-start=0 --adversarial-start=10 \ + --discriminator-size=48 \ + --train-noise=2.0 --train-jpeg=30 diff --git a/scripts/ne2x-photo-default.sh b/scripts/ne2x-photo-default.sh new file mode 100644 index 0000000..6ef41a7 --- /dev/null +++ b/scripts/ne2x-photo-default.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +python3.4 enhance.py \ + --train "$OPEN_IMAGES_PATH/*/*.jpg" --type photo --model default \ + --epochs=50 --batch-shape=256 --device=gpu0 \ + --generator-downscale=0 --generator-upscale=1 \ + --generator-blocks=8 --generator-filters=128 --generator-residual=0 \ + --perceptual-layer=conv2_2 --smoothness-weight=1e7 --adversary-weight=0.0 \ + --train-noise=1.0 + +python3.4 enhance.py \ + --train "$OPEN_IMAGES_PATH/*/*.jpg" --type photo --model default \ + --epochs=500 --batch-shape=240 --device=gpu0 \ + --generator-downscale=0 --generator-upscale=1 \ + --perceptual-layer=conv5_2 --smoothness-weight=5e3 --adversary-weight=5e1 \ + --generator-start=10 --discriminator-start=0 --adversarial-start=10 \ + --discriminator-size=64 \ + --train-noise=1.0 diff --git a/scripts/small-1x.sh b/scripts/small-1x.sh deleted file mode 100644 index 1e60c92..0000000 --- a/scripts/small-1x.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh - -python3.4 enhance.py \ - --train "$OPEN_IMAGES_PATH/*/*.jpg" --model small \ - --epochs=50 --batch-shape=192 --device=gpu0 \ - --generator-downscale=2 --generator-upscale=2 \ - --generator-blocks=8 --generator-filters=64 \ - --perceptual-layer=conv2_2 --smoothness-weight=1e7 --adversary-weight=0.0 \ - --train-blur=3 --train-noise=5.0 - -python3.4 enhance.py \ - --train "$OPEN_IMAGES_PATH/*/*.jpg" --model small \ - --epochs=500 --batch-shape=192 --device=gpu0 \ - --generator-downscale=2 --generator-upscale=2 \ - --perceptual-layer=conv5_2 --smoothness-weight=2e4 --adversary-weight=2e2 \ - --generator-start=5 --discriminator-start=0 --adversarial-start=5 \ - --discriminator-size=32 \ - --train-blur=3 --train-noise=5.0 diff --git a/scripts/small-2x.sh b/scripts/small-2x.sh deleted file mode 100644 index 2e8bdc2..0000000 --- a/scripts/small-2x.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh - -python3.4 enhance.py \ - --train "$OPEN_IMAGES_PATH/*/*.jpg" --model small \ - --epochs=50 --batch-shape=192 --device=gpu0 \ - --generator-downscale=1 --generator-upscale=2 \ - --generator-blocks=8 --generator-filters=64 \ - --perceptual-layer=conv2_2 --smoothness-weight=1e7 --adversary-weight=0.0 \ - --train-blur=2 --train-noise=4.0 - -python3.4 enhance.py \ - --train "$OPEN_IMAGES_PATH/*/*.jpg" --model small \ - --epochs=500 --batch-shape=192 --device=gpu0 \ - --generator-downscale=1 --generator-upscale=2 \ - --perceptual-layer=conv5_2 --smoothness-weight=2e4 --adversary-weight=2e2 \ - --generator-start=5 --discriminator-start=0 --adversarial-start=5 \ - --discriminator-size=32 \ - --train-blur=2 --train-noise=4.0 diff --git a/scripts/small-4x.sh b/scripts/small-4x.sh deleted file mode 100644 index 17d0493..0000000 --- a/scripts/small-4x.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh - -python3.4 enhance.py \ - --train "$OPEN_IMAGES_PATH/*/*.jpg" --model small \ - --epochs=50 --batch-shape=192 --device=gpu0 \ - --generator-downscale=0 --generator-upscale=2 \ - --generator-blocks=8 --generator-filters=64 \ - --perceptual-layer=conv2_2 --smoothness-weight=1e7 --adversary-weight=0.0 \ - --train-blur=1 --train-noise=3.0 - -python3.4 enhance.py \ - --train "$OPEN_IMAGES_PATH/*/*.jpg" --model small \ - --epochs=500 --batch-shape=192 --device=gpu0 \ - --generator-downscale=0 --generator-upscale=2 \ - --perceptual-layer=conv5_2 --smoothness-weight=2e4 --adversary-weight=2e2 \ - --generator-start=5 --discriminator-start=0 --adversarial-start=5 \ - --discriminator-size=32 \ - --train-blur=1 --train-noise=3.0