victorca25 / traiNNer

traiNNer: Deep learning framework for image and video super-resolution, restoration and image-to-image translation, for training and testing.
Apache License 2.0
284 stars 39 forks source link

I Have No Idea What I Am Doing to Cause This: #75

Open NickDeBeenSAE opened 1 year ago

NickDeBeenSAE commented 1 year ago
python3 train.py -opt train_sr.yml
Traceback (most recent call last):
  File "/home/nickdbts2022/Desktop/traiNNer/codes/train.py", line 500, in 
    main()
  File "/home/nickdbts2022/Desktop/traiNNer/codes/train.py", line 466, in main
    opt = parse_options()
  File "/home/nickdbts2022/Desktop/traiNNer/codes/train.py", line 25, in parse_options
    opt = options.parse(args.opt, is_train=is_train)
  File "/home/nickdbts2022/Desktop/traiNNer/codes/options/options.py", line 552, in parse
    raise ValueError("Configuration file {} not found.".format(opt_path))
ValueError: Configuration file options/train/train_sr.yml not found.
NickDeBeenSAE commented 1 year ago

Uuuuuuuuuhhhhhhh, pardon me?

You lost me.

NickDeBeenSAE commented 1 year ago
python3 train.py -opt train_sr.yml
export CUDA_VISIBLE_DEVICES=0
23-02-03 00:44:55.135 - INFO:   name: 001_sr_template
  use_tb_logger: True
  model: sr
  scale: 4
  gpu_ids: [0]
  use_amp: True
  use_swa: False
  use_cem: False
  use_atg: False
  datasets:[
    train:[
      name: DIV2K
      mode: aligned
      dataroot_HR: ['../datasets/train/hr1', '../datasets/train/hr2', '../datasets/train/hr3']
      dataroot_LR: ['../datasets/train/lr1', '../datasets/train/lr2']
      subset_file: None
      use_shuffle: True
      znorm: False
      n_workers: 4
      batch_size: 8
      virtual_batch_size: 8
      preprocess: crop
      crop_size: 128
      image_channels: 3
      use_flip: True
      use_rot: True
      use_hrrot: False
      phase: train
      scale: 4
      data_type: img
      aug_configs:[
        lr_downscale_types:[
          resize:[
            resize_prob:[
              down: 1.0
            ]
            resize_range_up: [1, 1.5]
            resize_range_down: [0.15, 1]
            down_up_min: 0.5
          ]
        ]
      ]
      shuffle_degradations: False
      lr_downscale: True
      lr_downscale_types: [773, 777]
      resize_strat: pre
    ]
    val:[
      name: val_set14_part
      mode: aligned
      dataroot_B: ../datasets/val/hr
      dataroot_A: ../datasets/val/lr
      znorm: False
      lr_downscale: False
      lr_downscale_types: [773, 777]
      phase: val
      scale: 4
      data_type: img
      resize_strat: pre
    ]
  ]
  path:[
    root: ..
    pretrain_model_G: ../experiments/pretrained_models/RRDB_PSNR_x4.pth
    experiments_root: ../experiments/001_sr_template
    models: ../experiments/001_sr_template/models
    training_state: ../experiments/001_sr_template/training_state
    log: ../experiments/001_sr_template
    val_images: ../experiments/001_sr_template/val_images
  ]
  train:[
    optim_G: adam
    optim_D: adam
    lr_scheme: MultiStepLR
    lr_gamma: 0.5
    swa_lr: 0.0001
    swa_anneal_epochs: 10
    swa_anneal_strategy: cos
    pixel_criterion: l1
    pixel_weight: 0.01
    feature_criterion: l1
    feature_weight: 1
    gan_type: vanilla
    gan_weight: 0.005
    manual_seed: 0
    niter: 500000.0
    val_freq: 5000.0
    metrics: psnr,ssim,lpips
    grad_clip: norm
    grad_clip_value: 0.1
    overwrite_val_imgs: None
    val_comparison: None
    lr_steps: [50000, 100000, 200000, 300000]
    swa_start_iter: 375000
    atg_start_iter: 415000
  ]
  logger:[
    print_freq: 200
    save_checkpoint_freq: 5000.0
    overwrite_chkp: False
  ]
  is_train: True
  network_G:[
    strict: False
    type: rrdb_net
    norm_type: None
    mode: CNA
    nf: 64
    nb: 23
    nr: 3
    in_nc: 3
    out_nc: 3
    gc: 32
    convtype: Conv2D
    act_type: leakyrelu
    gaussian_noise: True
    plus: False
    finalact: None
    upscale: 4
    upsample_mode: upconv
  ]
  network_D:[
    strict: True
    type: discriminator_vgg
    in_nc: 3
    base_nf: 64
    norm_type: batch
    mode: CNA
    act_type: leakyrelu
    convtype: Conv2D
    arch: ESRGAN
    size: 128
  ]

23-02-03 00:44:55.421 - INFO: Random seed: 0
Traceback (most recent call last):
  File "/home/nickdbts2022/Desktop/traiNNer/codes/train.py", line 500, in <module>
    main()
  File "/home/nickdbts2022/Desktop/traiNNer/codes/train.py", line 487, in main
    dataloaders, data_params = get_dataloaders(opt)
  File "/home/nickdbts2022/Desktop/traiNNer/codes/train.py", line 134, in get_dataloaders
    dataset = create_dataset(dataset_opt)
  File "/home/nickdbts2022/Desktop/traiNNer/codes/data/__init__.py", line 79, in create_dataset
    dataset = D(dataset_opt)
  File "/home/nickdbts2022/Desktop/traiNNer/codes/data/aligned_dataset.py", line 41, in __init__
    self.A_paths, self.B_paths = get_dataroots_paths(self.opt, strict=False, keys_ds=self.keys_ds)
  File "/home/nickdbts2022/Desktop/traiNNer/codes/data/base_dataset.py", line 235, in get_dataroots_paths
    paths_A, paths_B = read_dataroots(opt, keys_ds=keys_ds)
  File "/home/nickdbts2022/Desktop/traiNNer/codes/data/base_dataset.py", line 171, in read_dataroots
    paths_A = process_img_paths(A_images_paths, opt['data_type'])
  File "/home/nickdbts2022/Desktop/traiNNer/codes/data/base_dataset.py", line 61, in process_img_paths
    paths = get_image_paths(data_type, path, max_dataset_size)
  File "/home/nickdbts2022/Desktop/traiNNer/codes/dataops/common.py", line 82, in get_image_paths
    paths = sorted(_get_paths_from_images(dataroot, max_dataset_size=max_dataset_size))
  File "/home/nickdbts2022/Desktop/traiNNer/codes/dataops/common.py", line 36, in _get_paths_from_images
    assert os.path.isdir(path), '{:s} is not a valid directory'.format(path)
AssertionError: ../datasets/train/lr1 is not a valid directory
NickDeBeenSAE commented 1 year ago

I am lost, would someone help please? This is put politely as its the first time I am working with modelling code.

victorca25 commented 1 year ago

Hello!

These lines:

      dataroot_HR: ['../datasets/train/hr1', '../datasets/train/hr2', '../datasets/train/hr3']
      dataroot_LR: ['../datasets/train/lr1', '../datasets/train/lr2']

Are only an example, you should put here the paths to your image datasets for training (https://github.com/victorca25/traiNNer#training, https://github.com/victorca25/traiNNer/blob/master/docs/howtotrain.md#normal-single-image-super-resolution-esrgan-srgan-pan-etc-models).

Something similar will happen with:

      dataroot_B: ../datasets/val/hr
      dataroot_A: ../datasets/val/lr

and:

    pretrain_model_G: ../experiments/pretrained_models/RRDB_PSNR_x4.pth

The required files will have to exist in the path for them to be loaded correctly.

NickDeBeenSAE commented 8 months ago

Oh, well, ok then, I'll try this with my own version of the code.

Thank you.