BasicSR
BasicSR copied to clipboard
用自己的数据集训练EDVR
您好,非常感谢您作出这个实用的SR工具,现在我想用自己制作的视频数据集去训练EDVR,但是我的预设有些不太清楚的地方
我的数据集制作成了和REDS数据集相似的样子,但是有些地方不一样,分辨率方面我的GT是19201080的分辨率,bicubic是420270;REDS是每个视频100帧,我的数据集每个视频128帧,我一共有200个视频,我像REDS那样把他们从000命名到200,然后里面是png图像的格式,现在我在那个预设的.yml文件里的某些设置可能不太对,但是我也不太清楚哪里出了问题。
general settings
name: 104_EDVR_L_x4_SR_GameDataset_600k_B4G1_valGameDataset4_103pretrain_wandb model_type: EDVRModel scale: 4 num_gpu: 1 # set num_gpu: 0 for cpu mode manual_seed: 10
dataset and data loader settings
datasets: train: name: GameDataset type: REDSDataset dataroot_gt: datasets/GameDataset/train_sharp dataroot_lq: datasets/GameDataset/train_sharp_bicubic dataroot_flow: ~ meta_info_file: basicsr/data/meta_info/meta_info_GameDataset_GT.txt val_partition: GameDataset4 # set to 'official' when use the official validation partition io_backend: type: disk
num_frame: 5
gt_size: 256
interval_list: [1]
random_reverse: false
use_flip: true
use_rot: true
# data loader
use_shuffle: true
num_worker_per_gpu: 3
batch_size_per_gpu: 4
dataset_enlarge_ratio: 200
prefetch_mode: ~
val: name: GameDataset4 type: VideoTestDataset dataroot_gt: datasets/GameDataset4/train_sharp dataroot_lq: datasets/GameDataset4/train_sharp_bicubic meta_info_file: basicsr/data/meta_info/meta_info_GameDataset4_test_GT.txt # change to 'meta_info_GameDatasetofficial4_test_GT' when use the official validation partition io_backend: type: disk
cache_data: false
num_frame: 5
padding: reflection_circle
network structures
network_g: type: EDVR num_in_ch: 3 num_out_ch: 3 num_feat: 128 num_frame: 5 deformable_groups: 8 num_extract_block: 5 num_reconstruct_block: 40 center_frame_idx: ~ hr_in: false with_predeblur: false with_tsa: true
path
path: pretrain_network_g: experiments/pretrained_models/EDVR/EDVR_L_x4_SR_GameDataset.pth strict_load_g: false resume_state: ~
training settings
train: optim_g: type: Adam lr: !!float 4e-4 weight_decay: 0 betas: [0.9, 0.99]
scheduler: type: CosineAnnealingRestartLR periods: [50000, 100000, 150000, 150000, 150000] restart_weights: [1, 0.5, 0.5, 0.5, 0.5] eta_min: !!float 1e-7
total_iter: 600000 warmup_iter: -1 # no warm up tsa_iter: 50000 dcn_lr_mul: 1
losses
pixel_opt: type: CharbonnierLoss loss_weight: 1.0 reduction: sum
validation settings
val: val_freq: !!float 5e3 save_img: false
metrics: psnr: # metric name, can be arbitrary type: calculate_psnr crop_border: 0 test_y_channel: false
logging settings
logger: print_freq: 100 save_checkpoint_freq: !!float 5e3 use_tb_logger: true wandb: project: ~ resume_id: ~
dist training settings
dist_params: backend: nccl port: 29500
find_unused_parameters: true
这是我的预设,但是最后会出现这种问题:
Traceback (most recent call last):
File "basicsr/train.py", line 205, in
meta_info里的内容我也相对应地改了的:
000 128 (1080,1920,3) 001 128 (1080,1920,3) 002 128 (1080,1920,3) 003 128 (1080,1920,3) 004 128 (1080,1920,3) 005 128 (1080,1920,3) 006 128 (1080,1920,3) 007 128 (1080,1920,3) 008 128 (1080,1920,3) 009 128 (1080,1920,3) 010 128 (1080,1920,3) 011 128 (1080,1920,3) 012 128 (1080,1920,3) 013 128 (1080,1920,3) 014 128 (1080,1920,3) 015 128 (1080,1920,3) 016 128 (1080,1920,3) ............
您好,我找出了问题,是最后多了一行空白导致读取错误 ...... 197 128 (1080,1920,3) 198 128 (1080,1920,3) 199 128 (1080,1920,3) 200 128 (1080,1920,3) (这里有一行空白忘去掉了)
您好,虽然上一个问题解决了,但是我得预设好像还是有问题,请问一下如果我用自己的这个数据集进行训练的话,dataset的type我该如何选择
You need to rewrite your dataloader for your own data. Generally, the definition of the dataloaders are here and you need to write your dataloader in one file follow the pre-defined dataloaders. Then just change your .yml file to use your dataloader.