k4yt3x / video2x

A machine learning-based lossless video super resolution framework. Est. Hack the Valley II, 2018.
https://video2x.org
GNU Affero General Public License v3.0
10.77k stars 1.01k forks source link

YAML and JSON Related Errors #203

Closed qmouadcart closed 4 years ago

qmouadcart commented 4 years ago

Environment Information

Installed Modules
Video2X Latest
FFmpeg Latest
waifu2x-caffe Latest
waifu2x-converter-cpp Latest
waifu2x-ncnn-vulkan Latest
Anime4K
All Dependencies I forgot to mention, the setup was completely satisfied.

All versions are on latest

Description:

When running video2x with the following video2x.yaml:

---
waifu2x_caffe:
  path: C:\Users\MyUsername\AppData\Local\video2x\waifu2x-caffe\waifu2x-caffe-cui
  input_extention_list:
  output_extention:
  mode: noise_scale
  scale_ratio:
  scale_width:
  scale_height:
  noise_level: 3
  process: gpu
  crop_size: 128
  output_quality: -1
  output_depth: 8
  batch_size: 1
  gpu: 0
  tta: 0
  input_path:
  output_path:
  model_dir:
  crop_w:
  crop_h:
waifu2x_converter:
  path: C:\Users\MyUsername\AppData\Local\video2x\waifu2x-converter-cpp
  output-format:
  png-compression:
  image-quality:
  block-size:
  disable-gpu:
  force-OpenCL:
  processor:
  jobs:
  model-dir:
  scale-ratio:
  noise-level: 3
  mode: noise-scale
  silent: true
  output:
  input:
waifu2x_ncnn_vulkan:
  path: C:\Users\MyUsername\AppData\Local\video2x\waifu2x-ncnn-vulkan\waifu2x-ncnn-vulkan
  v:
  i:
  o:
  n: 2
  s: 2
  t: 400
  m: models-cunet
  g: 0
  j: "1:2:2"
anime4k:
  path: C:\Users\MyUsername\AppData\Local\video2x\anime4k\Anime4K.jar
  java_path:C:\Program Files\Java\jdk-13.0.2\bin\java.exe
ffmpeg:
  ffmpeg_path: C:\Users\MyUsername\AppData\Local\video2x\ffmpeg-latest-win64-static\bin
  video_to_frames:
    output_options:
      "-qscale:v":
      "-pix_fmt": rgba64be
    "-hwaccel": auto
    "-y": true
  frames_to_video:
    input_options:
      "-qscale:v":
      "-qscale:a":
      "-f": image2
    output_options:
      "-vcodec": libx264
      "-crf": 17
      "-b:v":
      "-pix_fmt":
    "-hwaccel": auto
    "-y": true
  migrating_tracks:
    output_options:
      "-map":
        - 0:v?
        - 1:a?
        - 1:s?
        - 1:d?
        - 1:t?
      "-c": copy
      "-pix_fmt":
    "-hwaccel": auto
    "-y": true
video2x:
  video2x_cache_directory:cache
  image_format: png
  preserve_frames: false

I am met with the following in the CLI:

G:\Projects\Upscaling\video2x-master\src>python video2x.py -i in.mkv -o out.mkv -r 2 -d anime4k

    __      __  _       _                  ___   __   __
    \ \    / / (_)     | |                |__ \  \ \ / /
     \ \  / /   _    __| |   ___    ___      ) |  \ V /
      \ \/ /   | |  / _` |  / _ \  / _ \    / /    > <
       \  /    | | | (_| | |  __/ | (_) |  / /_   / . \
        \/     |_|  \__,_|  \___|  \___/  |____| /_/ \_\

                  Video2X Video Enlarger

                       Version 3.0.0

[!] WARNING: Anime4K runs significantly faster with more threads
[?] USER: Use more threads of Anime4K? [Y/n]: Y
[?] USER: Amount of threads to use [5]: 5
Traceback (most recent call last):
  File "video2x.py", line 304, in <module>
    config = read_config(args.config)
  File "video2x.py", line 201, in read_config
    return yaml.load(config, Loader=yaml.FullLoader)
  File "C:\Users\MyUsername\AppData\Local\Programs\Python\Python37\lib\site-packages\yaml\__init__.py", line 114, in load
    return loader.get_single_data()
  File "C:\Users\MyUsername\AppData\Local\Programs\Python\Python37\lib\site-packages\yaml\constructor.py", line 41, in get_single_data
    node = self.get_single_node()
  File "C:\Users\MyUsername\AppData\Local\Programs\Python\Python37\lib\site-packages\yaml\composer.py", line 36, in get_single_node
    document = self.compose_document()
  File "C:\Users\MyUsername\AppData\Local\Programs\Python\Python37\lib\site-packages\yaml\composer.py", line 55, in compose_document
    node = self.compose_node(None, None)
  File "C:\Users\MyUsername\AppData\Local\Programs\Python\Python37\lib\site-packages\yaml\composer.py", line 84, in compose_node
    node = self.compose_mapping_node(anchor)
  File "C:\Users\MyUsername\AppData\Local\Programs\Python\Python37\lib\site-packages\yaml\composer.py", line 133, in compose_mapping_node
    item_value = self.compose_node(node, item_key)
  File "C:\Users\MyUsername\AppData\Local\Programs\Python\Python37\lib\site-packages\yaml\composer.py", line 84, in compose_node
    node = self.compose_mapping_node(anchor)
  File "C:\Users\MyUsername\AppData\Local\Programs\Python\Python37\lib\site-packages\yaml\composer.py", line 127, in compose_mapping_node
    while not self.check_event(MappingEndEvent):
  File "C:\Users\MyUsername\AppData\Local\Programs\Python\Python37\lib\site-packages\yaml\parser.py", line 98, in check_event
    self.current_event = self.state()
  File "C:\Users\MyUsername\AppData\Local\Programs\Python\Python37\lib\site-packages\yaml\parser.py", line 428, in parse_block_mapping_key
    if self.check_token(KeyToken):
  File "C:\Users\MyUsername\AppData\Local\Programs\Python\Python37\lib\site-packages\yaml\scanner.py", line 115, in check_token
    while self.need_more_tokens():
  File "C:\Users\MyUsername\AppData\Local\Programs\Python\Python37\lib\site-packages\yaml\scanner.py", line 152, in need_more_tokens
    self.stale_possible_simple_keys()
  File "C:\Users\MyUsername\AppData\Local\Programs\Python\Python37\lib\site-packages\yaml\scanner.py", line 292, in stale_possible_simple_keys
    "could not find expected ':'", self.get_mark())
yaml.scanner.ScannerError: while scanning a simple key
  in "G:\Projects\Upscaling\video2x-master\src\video2x.yaml", line 53, column 3
could not find expected ':'
  in "G:\Projects\Upscaling\video2x-master\src\video2x.yaml", line 54, column 1

G:\Projects\Upscaling\video2x-master\src>

In GUI:

Upscaler ran into an error:
while scanning a simple key
  in "G:\Projects\Upscaling\video2x-master\src\video2x.yaml", line 53, column 3
could not find expected ':'
  in "G:\Projects\Upscaling\video2x-master\src\video2x.yaml", line 54, column 1

With -c video2x.json:

G:\Projects\Upscaling\video2x-master\src>python video2x.py -i in.mkv -o out.mkv -r 2 -d anime4k -c video2x.json

    __      __  _       _                  ___   __   __
    \ \    / / (_)     | |                |__ \  \ \ / /
     \ \  / /   _    __| |   ___    ___      ) |  \ V /
      \ \/ /   | |  / _` |  / _ \  / _ \    / /    > <
       \  /    | | | (_| | |  __/ | (_) |  / /_   / . \
        \/     |_|  \__,_|  \___|  \___/  |____| /_/ \_\

                  Video2X Video Enlarger

                       Version 3.0.0

[!] WARNING: Anime4K runs significantly faster with more threads
[?] USER: Use more threads of Anime4K? [Y/n]: Y
[?] USER: Amount of threads to use [5]: 5
Traceback (most recent call last):
  File "video2x.py", line 312, in <module>
    if not pathlib.Path(driver_settings['path']).is_file():
KeyError: 'path'

G:\Projects\Upscaling\video2x-master\src>

Said JSON:

{
  "waifu2x_caffe": {
    "waifu2x_caffe_path": "C:\\Users\\MyUsername\\AppData\\Local\\video2x\\waifu2x-caffe\\waifu2x-caffe-cui.exe",
    "input_extention_list": null,
    "output_extention": null,
    "mode": "noise_scale",
    "scale_ratio": null,
    "scale_width": null,
    "scale_height": null,
    "noise_level": 3,
    "process": "gpu",
    "crop_size": 128,
    "output_quality": -1,
    "output_depth": 8,
    "batch_size": 1,
    "gpu": 0,
    "tta": 0,
    "input_path": null,
    "output_path": null,
    "model_dir": null,
    "crop_w": null,
    "crop_h": null
  },
  "waifu2x_converter": {
    "waifu2x_converter_path": "C:\\Users\\MyUsername\\AppData\\Local\\video2x\\waifu2x-converter-cpp",
    "output-format": null,
    "png-compression": null,
    "image-quality": null,
    "block-size": null,
    "disable-gpu": null,
    "force-OpenCL": null,
    "processor": null,
    "jobs": null,
    "model-dir": null,
    "scale-ratio": null,
    "noise-level": 3,
    "mode": "noise-scale",
    "silent": true,
    "output": null,
    "input": null
  },
  "waifu2x_ncnn_vulkan": {
    "waifu2x_ncnn_vulkan_path": "C:\\Users\\MyUsername\\AppData\\Local\\video2x\\waifu2x-ncnn-vulkan\\waifu2x-ncnn-vulkan.exe",
    "v": null,
    "i": null,
    "o": null,
    "n": 2,
    "s": 2,
    "t": 400,
    "m": "models-cunet",
    "g": 0,
    "j": "1:2:2"
  },
  "anime4k": {
    "anime4k_path": "C:\\Users\\MyUsername\\AppData\\Local\\video2x\\anime4k\\Anime4K.jar",
    "java_path": "C:\\Program Files\\Java\\jdk-13.0.2\\bin\\java.exe"
  },
  "ffmpeg": {
    "ffmpeg_path": "C:\\Users\\MyUsername\\AppData\\Local\\video2x\\ffmpeg-latest-win64-static\\bin",
    "video_to_frames": {
      "output_options": {
        "-qscale:v": null,
        "-pix_fmt": "rgba64be"
      },
      "-hwaccel": "auto",
      "-y": true
    },
    "frames_to_video": {
      "input_options": {
        "-qscale:v": null,
        "-qscale:a": null,
        "-f": "image2"
      },
      "output_options": {
        "-vcodec": "libx264",
        "-crf": 17,
        "-b:v": null,
        "-pix_fmt": null
      },
      "-hwaccel": "auto",
      "-y": true
    },
    "migrating_tracks": {
      "output_options": {
        "-map": [
          "0:v:0?",
          "1?",
          "-1:v?"
        ],
        "-c": "copy",
        "-pix_fmt": null
      },
      "-hwaccel": "auto",
      "-y": true
    }
  },
  "video2x": {
    "video2x_cache_directory": "cache",
    "image_format": "png",
    "preserve_frames": false
  }
}

Happens with all upscalers, sizes etc. I have a cache path on the root of the drive I'm on, and also in the folder. input and output files are valid, replaced my real username with MyUsername.

k4yt3x commented 4 years ago

You're missing a space here: image

And a space here: image

They are causing YAML parser to raise syntax errors.

qmouadcart commented 4 years ago

It works! TYSM