Skip to content
This repository was archived by the owner on Jan 2, 2021. It is now read-only.

Commit b1c054c

Browse files
committed
Improve the README for applying and training models.
1 parent f868514 commit b1c054c

File tree

2 files changed

+21
-15
lines changed

2 files changed

+21
-15
lines changed

README.rst

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ The catch? The neural network is hallucinating details based on its training fro
1919

2020
|Python Version| |License Type| |Project Stars|
2121

22-
----
23-
2422
1. Examples & Usage
2523
===================
2624

@@ -36,29 +34,37 @@ The default is to use ``--device=cpu``, if you have NVIDIA card setup with CUDA
3634

3735
.. code:: bash
3836
39-
# Run the super-resolution script for one or more images.
37+
# Run the super-resolution script for one image.
4038
python3 enhance.py example.png
4139
42-
# Display output image that has `_enhanced.png` suffix.
43-
open example_enhanced.png
40+
# Also process multiple files with a single run.
41+
python3 enhance.py file1.jpg file2.jpg
42+
43+
# Display output images that were given `_ne4x.png` suffix.
44+
open *_ne4x.png
4445
4546
4647
1.b) Training Super-Resolution
4748
------------------------------
4849

50+
Pre-trained models are provided in the GitHub releases. Training your own is a delicate process that may require you to pick parameters based on your image dataset.
51+
4952
.. code:: bash
5053
51-
rm -f ne4x.pkl.bz2
54+
# Remove the model file as don't want to reload the data to fine-tune it.
55+
rm -f ne4x*.pkl.bz2
5256
53-
python3.4 enhance.py --train --epochs=25 \
54-
--scales=2 --perceptual-layer=conv2_2 \
55-
--generator-block=16 --generator-filters=128 \
56-
--smoothness-weight=1e7 --adversary-weight=0.0
57+
# Pre-train the model using perceptual loss from paper [1] below.
58+
python3.4 enhance.py --train --scales=2 --epochs=50 \
59+
--perceptual-layer=conv2_2 --smoothness-weight=1e7 --adversary-weight=0.0 \
60+
--generator-blocks=4 --generator-filters=64
61+
62+
# Train the model using an adversarial setup based on [4] below.
63+
python3.4 enhance.py --train --scales=2 --epochs=250 \
64+
--perceptual-layer=conv5_2 --smoothness-weight=2e4 --adversary-weight=1e3 \
65+
--generator-start=5 --discriminator-start=0 --adversarial-start=5 \
66+
--discriminator-size=64
5767
58-
python3.4 enhance.py --train --epochs=250 \
59-
--scales=2 --perceptual-layer=conv5_2 \
60-
--smoothness-weight=5e4 --adversary-weight=2e2 \
61-
--generator-start=1 --discriminator-start=0 --adversarial-start=1
6268
6369
.. image:: docs/BankLobby_example.gif
6470

enhance.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ def process(self, image):
504504
for filename in args.files:
505505
print(filename)
506506
out = enhancer.process(scipy.ndimage.imread(filename, mode='RGB'))
507-
out.save(os.path.splitext(filename)[0]+'_ne%ix-%s.png'%(2**args.scales, args.model))
507+
out.save(os.path.splitext(filename)[0]+'_ne%ix.png'%(2**args.scales))
508508

509509
if args.files:
510510
print(ansi.ENDC)

0 commit comments

Comments
 (0)