Code Monkey home page Code Monkey logo

Comments (7)

tsurumeso avatar tsurumeso commented on May 28, 2024

I could not reproduce that situation.
Could you tell me the command you executed and the size of the input image?

from waifu2x-chainer.

 avatar commented on May 28, 2024

Source image:
2019-02-27_Flight-of-Spring_by-David-Revoy

For CPU:

ucok66@ucok66:~/waifu2x-chainer$ python waifu2x.py -e png -a 3 -m noise_scale -S 2000 -n 2 -t -T 2 -b 20 -l 256 -i /home/ucok66/2019-02-27_Flight-of-Spring_by-David-Revoy.jpg -o /home/ucok66/
2.0x upscaling... 0 1 OK
2.0x upscaling... 0 1 OK
Resizing... OK
Elapsed time: 611.125334 sec
Saved as '/home/ucok66/2019-02-27_Flight-of-Spring_by-David-Revoy.png'

2019-02-27_Flight-of-Spring_by-David-Revoy

for GPU

ucok66@ucok:~/waifu2x-chainer$ python waifu2x.py -g 0 -e png -a 3 -m noise_scale -S 2000 -n 2 -t -T 2 -b 20 -l 256 -i /home/ucok66/2019-02-27_Flight-of-Spring_by-David-Revoy.jpg -o /home/ucok66/
2.0x upscaling... 0 1 OK
2.0x upscaling... 0 1 OK
Resizing... OK
Elapsed time: 5.569068 sec
Saved as '/home/ucok66/2019-02-27_Flight-of-Spring_by-David-Revoy_(tta2)(noise2_scale3.0x)(upresnet10_rgb).png'

2019-02-27_Flight-of-Spring_by-David-Revoy_(tta2)(noise2_scale3 0x)(upresnet10_rgb)

Hmm, I thought only GPU have this problem, but the CPU has this problem too. Initially, I wanted to enlarge my image with the size of 2000px for the smallest side, but both of them only produced 1923px

from waifu2x-chainer.

tsurumeso avatar tsurumeso commented on May 28, 2024

Maybe adding line from __future__ import division to the beginning of waifu2x.py will solve this issue.
Could you try it?

from waifu2x-chainer.

 avatar commented on May 28, 2024

hmm.

ucok66@ucok66:~/waifu2x-chainer$ python from __future__ import division waifu2x.py -e png -a 3 -m noise_scale -S 2000 -n 2 -t -T 2 -b 20 -l 256 -i /home/ucok66/2019-02-27_Flight-of-Spring_by-David-Revoy.jpg -o /home/ucok66/ 
python: can't open file 'from': [Errno 2] No such file or directory
ucok66@ucok66:~/waifu2x-chainer$ python waifu2x.py from __future__ import division -e png -a 3 -m noise_scale -S 2000 -n 2 -t -T 2 -b 20 -l 256 -i /home/ucok66/2019-02-27_Flight-of-Spring_by-David-Revoy.jpg -o /home/ucok66/
usage: waifu2x.py [-h] [--gpu GPU] [--input INPUT] [--output_dir OUTPUT_DIR]
                  [--extension EXTENSION] [--quality QUALITY]
                  [--arch {VGG7,0,UpConv7,1,ResNet10,2,UpResNet10,3}]
                  [--model_dir MODEL_DIR] [--method {noise,scale,noise_scale}]
                  [--scale_ratio SCALE_RATIO] [--noise_level {0,1,2,3}]
                  [--color {y,rgb}] [--tta] [--tta_level {2,4,8}]
                  [--batch_size BATCH_SIZE] [--block_size BLOCK_SIZE]
                  [--width WIDTH | --height HEIGHT | --shorter_side SHORTER_SIDE | --longer_side LONGER_SIDE]
waifu2x.py: error: unrecognized arguments: from __future__ import division

Which one works?

from waifu2x-chainer.

tsurumeso avatar tsurumeso commented on May 28, 2024

Oh, sorry. It means to open waifu2x.py in a text editor and editing like this.

from __future__ import division   # Add this line
import argparse
import os
import time
...

from waifu2x-chainer.

 avatar commented on May 28, 2024

It is work
2019-02-27_Flight-of-Spring_by-David-Revoy
What is happen?

from waifu2x-chainer.

tsurumeso avatar tsurumeso commented on May 28, 2024

In Python 2, the / operator is integer division if inputs are integers.
So the scale_ratio will be 2000 / 900 = 2 although it should be 2.22.
In Python 3 or using from __future__ import division in Python 2, the / operator is float division.
If you use float division, scale_ratio is correctly calculated to be 2.22.

from waifu2x-chainer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.