How to use custom_gt method in pandera

Best Python code snippet using pandera_python

basicvsr_reds4_custom_load_lr_small.py

Source:basicvsr_reds4_custom_load_lr_small.py Github

copy

Full Screen

1exp_name = 'basicvsr_reds4_custom_load_lr_small'2# model settings3model = dict(4 type='BasicVSR',5 generator=dict(6 type='BasicVSRNet',7 mid_channels=64,8 num_blocks=30,9 spynet_pretrained='https://download.openmmlab.com/mmediting/restorers/'10 'basicvsr/spynet_20210409-c6c1bd09.pth'),11 pixel_loss=dict(type='CharbonnierLoss', loss_weight=1.0, reduction='mean'))12# model training and testing settings13train_cfg = dict(fix_iter=5000)14test_cfg = dict(metrics=['PSNR', 'SSIM'], crop_border=0)15# dataset settings16train_dataset_type = 'SRREDSMultipleGTDataset_CUSTOM'17val_dataset_type = 'SRREDSMultipleGTDataset_CUSTOM'18train_pipeline = [19 dict(type='GenerateSegmentIndices', interval_list=[1]),20 dict(type='TemporalReverse', keys='lq_path', reverse_ratio=0),21 dict(22 type='LoadImageFromFileList',23 io_backend='disk',24 key='lq',25 channel_order='rgb'),26 dict(27 type='LoadImageFromFileList',28 io_backend='disk',29 key='gt',30 channel_order='rgb'),31 dict(type='RescaleToZeroOne', keys=['lq', 'gt']),32 dict(type='PairedRandomCrop', gt_patch_size=256),33 dict(34 type='Flip', keys=['lq', 'gt'], flip_ratio=0.5,35 direction='horizontal'),36 dict(type='Flip', keys=['lq', 'gt'], flip_ratio=0.5, direction='vertical'),37 dict(type='RandomTransposeHW', keys=['lq', 'gt'], transpose_ratio=0.5),38 dict(type='FramesToTensor', keys=['lq', 'gt']),39 dict(type='Collect', keys=['lq', 'gt'], meta_keys=['lq_path', 'gt_path'])40]41test_pipeline = [42 dict(type='GenerateSegmentIndices', interval_list=[1]),43 dict(44 type='LoadImageFromFileList',45 io_backend='disk',46 key='lq',47 channel_order='rgb'),48 dict(49 type='LoadImageFromFileList',50 io_backend='disk',51 key='gt',52 channel_order='rgb'),53 dict(type='RescaleToZeroOne', keys=['lq', 'gt']),54 dict(type='FramesToTensor', keys=['lq', 'gt']),55 dict(56 type='Collect',57 keys=['lq', 'gt'],58 meta_keys=['lq_path', 'gt_path', 'key'])59]60demo_pipeline = [61 dict(type='GenerateSegmentIndices', interval_list=[1]),62 dict(63 type='LoadImageFromFileList',64 io_backend='disk',65 key='lq',66 channel_order='rgb'),67 dict(type='RescaleToZeroOne', keys=['lq']),68 dict(type='FramesToTensor', keys=['lq']),69 dict(type='Collect', keys=['lq'], meta_keys=['lq_path', 'key'])70]71data = dict(72 workers_per_gpu=6,73 train_dataloader=dict(samples_per_gpu=16, drop_last=True), # 2 gpus74 val_dataloader=dict(samples_per_gpu=1),75 test_dataloader=dict(samples_per_gpu=1, workers_per_gpu=1),76 # train77 train=dict(78 type='RepeatDataset',79 times=1000,80 dataset=dict(81 type=train_dataset_type,82 lq_folder='/data/peiyuan/custom_train/custom_low_res',83 gt_folder='/data/peiyuan/custom_train/custom_gt',84 num_input_frames=15,85 pipeline=train_pipeline,86 scale=4,87 val_partition='REDS4',88 test_mode=False)),89 # val90 val=dict(91 type=val_dataset_type,92 lq_folder='/data/peiyuan/custom_train/custom_low_res',93 gt_folder='/data/peiyuan/custom_train/custom_gt',94 num_input_frames=100,95 pipeline=test_pipeline,96 scale=4,97 val_partition='REDS4',98 test_mode=True),99 # test100 test=dict(101 type=val_dataset_type,102 lq_folder='/data/peiyuan/custom_train/custom_low_res',103 gt_folder='/data/peiyuan/custom_train/custom_gt',104 num_input_frames=100,105 pipeline=test_pipeline,106 scale=4,107 val_partition='REDS4',108 test_mode=True),109)110# optimizer111optimizers = dict(112 generator=dict(113 type='Adam',114 lr=8e-5,115 betas=(0.9, 0.99),116 paramwise_cfg=dict(custom_keys={'spynet': dict(lr_mult=0.125)})))117# learning policy118total_iters = 150000119lr_config = dict(120 policy='CosineRestart',121 by_epoch=False,122 periods=[150000],123 restart_weights=[1],124 min_lr=1e-7)125checkpoint_config = dict(interval=2500, save_optimizer=True, by_epoch=False)126# remove gpu_collect=True in non distributed training127evaluation = dict(interval=2500, save_image=False, gpu_collect=True)128log_config = dict(129 interval=100,130 hooks=[131 dict(type='TextLoggerHook', by_epoch=False),132 # dict(type='TensorboardLoggerHook'),133 ])134visual_config = None135# runtime settings136dist_params = dict(backend='nccl')137log_level = 'INFO'138work_dir = f'./work_dirs/{exp_name}'139load_from = None140resume_from = None141workflow = [('train', 1)]...

Full Screen

Full Screen

basicvsr_reds4_custom_load.py

Source:basicvsr_reds4_custom_load.py Github

copy

Full Screen

1exp_name = 'basicvsr_reds4_custom_load'2# model settings3model = dict(4 type='BasicVSR',5 generator=dict(6 type='BasicVSRNet',7 mid_channels=64,8 num_blocks=30,9 spynet_pretrained='https://download.openmmlab.com/mmediting/restorers/'10 'basicvsr/spynet_20210409-c6c1bd09.pth'),11 pixel_loss=dict(type='CharbonnierLoss', loss_weight=1.0, reduction='mean'))12# model training and testing settings13train_cfg = dict(fix_iter=5000)14test_cfg = dict(metrics=['PSNR', 'SSIM'], crop_border=0)15# dataset settings16train_dataset_type = 'SRREDSMultipleGTDataset_CUSTOM'17val_dataset_type = 'SRREDSMultipleGTDataset_CUSTOM'18train_pipeline = [19 dict(type='GenerateSegmentIndices', interval_list=[1]),20 dict(type='TemporalReverse', keys='lq_path', reverse_ratio=0),21 dict(22 type='LoadImageFromFileList',23 io_backend='disk',24 key='lq',25 channel_order='rgb'),26 dict(27 type='LoadImageFromFileList',28 io_backend='disk',29 key='gt',30 channel_order='rgb'),31 dict(type='RescaleToZeroOne', keys=['lq', 'gt']),32 dict(type='PairedRandomCrop', gt_patch_size=256),33 dict(34 type='Flip', keys=['lq', 'gt'], flip_ratio=0.5,35 direction='horizontal'),36 dict(type='Flip', keys=['lq', 'gt'], flip_ratio=0.5, direction='vertical'),37 dict(type='RandomTransposeHW', keys=['lq', 'gt'], transpose_ratio=0.5),38 dict(type='FramesToTensor', keys=['lq', 'gt']),39 dict(type='Collect', keys=['lq', 'gt'], meta_keys=['lq_path', 'gt_path'])40]41test_pipeline = [42 dict(type='GenerateSegmentIndices', interval_list=[1]),43 dict(44 type='LoadImageFromFileList',45 io_backend='disk',46 key='lq',47 channel_order='rgb'),48 dict(49 type='LoadImageFromFileList',50 io_backend='disk',51 key='gt',52 channel_order='rgb'),53 dict(type='RescaleToZeroOne', keys=['lq', 'gt']),54 dict(type='FramesToTensor', keys=['lq', 'gt']),55 dict(56 type='Collect',57 keys=['lq', 'gt'],58 meta_keys=['lq_path', 'gt_path', 'key'])59]60demo_pipeline = [61 dict(type='GenerateSegmentIndices', interval_list=[1]),62 dict(63 type='LoadImageFromFileList',64 io_backend='disk',65 key='lq',66 channel_order='rgb'),67 dict(type='RescaleToZeroOne', keys=['lq']),68 dict(type='FramesToTensor', keys=['lq']),69 dict(type='Collect', keys=['lq'], meta_keys=['lq_path', 'key'])70]71data = dict(72 workers_per_gpu=6,73 train_dataloader=dict(samples_per_gpu=16, drop_last=True), # 2 gpus74 val_dataloader=dict(samples_per_gpu=1),75 test_dataloader=dict(samples_per_gpu=1, workers_per_gpu=1),76 # train77 train=dict(78 type='RepeatDataset',79 times=1000,80 dataset=dict(81 type=train_dataset_type,82 lq_folder='/data/peiyuan/custom_train/custom_low_res',83 gt_folder='/data/peiyuan/custom_train/custom_gt',84 num_input_frames=15,85 pipeline=train_pipeline,86 scale=4,87 val_partition='REDS4',88 test_mode=False)),89 # val90 val=dict(91 type=val_dataset_type,92 lq_folder='/data/peiyuan/custom_train/custom_low_res',93 gt_folder='/data/peiyuan/custom_train/custom_gt',94 num_input_frames=100,95 pipeline=test_pipeline,96 scale=4,97 val_partition='REDS4',98 test_mode=True),99 # test100 test=dict(101 type=val_dataset_type,102 lq_folder='/data/peiyuan/custom_train/custom_low_res',103 gt_folder='/data/peiyuan/custom_train/custom_gt',104 num_input_frames=100,105 pipeline=test_pipeline,106 scale=4,107 val_partition='REDS4',108 test_mode=True),109)110# optimizer111optimizers = dict(112 generator=dict(113 type='Adam',114 lr=4e-4,115 betas=(0.9, 0.99),116 paramwise_cfg=dict(custom_keys={'spynet': dict(lr_mult=0.125)})))117# learning policy118total_iters = 150000119lr_config = dict(120 policy='CosineRestart',121 by_epoch=False,122 periods=[150000],123 restart_weights=[1],124 min_lr=1e-7)125checkpoint_config = dict(interval=1000, save_optimizer=True, by_epoch=False)126# remove gpu_collect=True in non distributed training127evaluation = dict(interval=1000, save_image=False, gpu_collect=True)128log_config = dict(129 interval=100,130 hooks=[131 dict(type='TextLoggerHook', by_epoch=False),132 # dict(type='TensorboardLoggerHook'),133 ])134visual_config = None135# runtime settings136dist_params = dict(backend='nccl')137log_level = 'INFO'138work_dir = f'./work_dirs/{exp_name}'139load_from = None140resume_from = None141workflow = [('train', 1)]...

Full Screen

Full Screen

basicvsr_reds4_custom.py

Source:basicvsr_reds4_custom.py Github

copy

Full Screen

1exp_name = 'basicvsr_reds4_custom'2# model settings3model = dict(4 type='BasicVSR',5 generator=dict(6 type='BasicVSRNet',7 mid_channels=64,8 num_blocks=30,9 spynet_pretrained='https://download.openmmlab.com/mmediting/restorers/'10 'basicvsr/spynet_20210409-c6c1bd09.pth'),11 pixel_loss=dict(type='CharbonnierLoss', loss_weight=1.0, reduction='mean'))12# model training and testing settings13train_cfg = dict(fix_iter=5000)14test_cfg = dict(metrics=['PSNR', 'SSIM'], crop_border=0)15# dataset settings16train_dataset_type = 'SRREDSMultipleGTDataset_CUSTOM'17val_dataset_type = 'SRREDSMultipleGTDataset_CUSTOM'18train_pipeline = [19 dict(type='GenerateSegmentIndices', interval_list=[1]),20 dict(type='TemporalReverse', keys='lq_path', reverse_ratio=0),21 dict(22 type='LoadImageFromFileList',23 io_backend='disk',24 key='lq',25 channel_order='rgb'),26 dict(27 type='LoadImageFromFileList',28 io_backend='disk',29 key='gt',30 channel_order='rgb'),31 dict(type='RescaleToZeroOne', keys=['lq', 'gt']),32 dict(type='PairedRandomCrop', gt_patch_size=256),33 dict(34 type='Flip', keys=['lq', 'gt'], flip_ratio=0.5,35 direction='horizontal'),36 dict(type='Flip', keys=['lq', 'gt'], flip_ratio=0.5, direction='vertical'),37 dict(type='RandomTransposeHW', keys=['lq', 'gt'], transpose_ratio=0.5),38 dict(type='FramesToTensor', keys=['lq', 'gt']),39 dict(type='Collect', keys=['lq', 'gt'], meta_keys=['lq_path', 'gt_path'])40]41test_pipeline = [42 dict(type='GenerateSegmentIndices', interval_list=[1]),43 dict(44 type='LoadImageFromFileList',45 io_backend='disk',46 key='lq',47 channel_order='rgb'),48 dict(49 type='LoadImageFromFileList',50 io_backend='disk',51 key='gt',52 channel_order='rgb'),53 dict(type='RescaleToZeroOne', keys=['lq', 'gt']),54 dict(type='FramesToTensor', keys=['lq', 'gt']),55 dict(56 type='Collect',57 keys=['lq', 'gt'],58 meta_keys=['lq_path', 'gt_path', 'key'])59]60demo_pipeline = [61 dict(type='GenerateSegmentIndices', interval_list=[1]),62 dict(63 type='LoadImageFromFileList',64 io_backend='disk',65 key='lq',66 channel_order='rgb'),67 dict(type='RescaleToZeroOne', keys=['lq']),68 dict(type='FramesToTensor', keys=['lq']),69 dict(type='Collect', keys=['lq'], meta_keys=['lq_path', 'key'])70]71data = dict(72 workers_per_gpu=6,73 train_dataloader=dict(samples_per_gpu=16, drop_last=True), # 2 gpus74 val_dataloader=dict(samples_per_gpu=1),75 test_dataloader=dict(samples_per_gpu=1, workers_per_gpu=1),76 # train77 train=dict(78 type='RepeatDataset',79 times=1000,80 dataset=dict(81 type=train_dataset_type,82 lq_folder='/data/peiyuan/custom_train/custom_low_res',83 gt_folder='/data/peiyuan/custom_train/custom_gt',84 num_input_frames=15,85 pipeline=train_pipeline,86 scale=4,87 val_partition='REDS4',88 test_mode=False)),89 # val90 val=dict(91 type=val_dataset_type,92 lq_folder='/data/peiyuan/custom_train/custom_low_res',93 gt_folder='/data/peiyuan/custom_train/custom_gt',94 num_input_frames=100,95 pipeline=test_pipeline,96 scale=4,97 val_partition='REDS4',98 test_mode=True),99 # test100 test=dict(101 type=val_dataset_type,102 lq_folder='/data/peiyuan/custom_train/custom_low_res',103 gt_folder='/data/peiyuan/custom_train/custom_gt',104 num_input_frames=100,105 pipeline=test_pipeline,106 scale=4,107 val_partition='REDS4',108 test_mode=True),109)110# optimizer111optimizers = dict(112 generator=dict(113 type='Adam',114 lr=4e-4,115 betas=(0.9, 0.99),116 paramwise_cfg=dict(custom_keys={'spynet': dict(lr_mult=0.125)})))117# learning policy118total_iters = 150000119lr_config = dict(120 policy='CosineRestart',121 by_epoch=False,122 periods=[150000],123 restart_weights=[1],124 min_lr=1e-7)125checkpoint_config = dict(interval=1000, save_optimizer=True, by_epoch=False)126# remove gpu_collect=True in non distributed training127evaluation = dict(interval=1000, save_image=False, gpu_collect=True)128log_config = dict(129 interval=100,130 hooks=[131 dict(type='TextLoggerHook', by_epoch=False),132 # dict(type='TensorboardLoggerHook'),133 ])134visual_config = None135# runtime settings136dist_params = dict(backend='nccl')137log_level = 'INFO'138work_dir = f'./work_dirs/{exp_name}'139load_from = None140resume_from = None141workflow = [('train', 1)]...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run pandera automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful