Demo 설정 살펴보기
/HAT/options/test

- 위 경로에서 미리 설정된 config.yaml파일들을 확인할 수 있다.
- SR : Super Resolution
- x2, x3, x4 : 64 -> 128, 192, 256, 각 원본이미지 w,h의 배수를 뜻한다.
- 위 yaml파일의 이름과 아래 설명할 pre-trained model파일의 이름을 맞추어 demo에서 사용한다.
(예 : HAT_SRx4_ImageNet-pretrain.yml을 사용할 경우 HAT_SRx4_ImageNet-pretrain.pth 다운로드)
Download pre-trained models
Edit config (yml)
name: HAT_SRx4_ImageNet-pretrain
model_type: HATModel
scale: 4
num_gpu: 1
manual_seed: 0
datasets:
test_1:
name: Set5
type: PairedImageDataset
dataroot_gt: ./datasets/[Ground Truth]
dataroot_lq: ./datasets/[Low Resolution]
io_backend:
type: disk
network_g:
type: HAT
upscale: 4
in_chans: 3
img_size: 64
window_size: 16
compress_ratio: 3
squeeze_factor: 30
conv_scale: 0.01
overlap_ratio: 0.5
img_range: 1.
depths: [6, 6, 6, 6, 6, 6]
embed_dim: 180
num_heads: [6, 6, 6, 6, 6, 6]
mlp_ratio: 2
upsampler: 'pixelshuffle'
resi_connection: '1conv'
path:
pretrain_network_g: ./experiments/pretrained_models/HAT_SRx4_ImageNet-pretrain.pth
strict_load_g: true
param_key_g: 'params_ema'
val:
save_img: true
suffix: ~
metrics:
psnr:
type: calculate_psnr
crop_border: 4
test_y_channel: true
ssim:
type: calculate_ssim
crop_border: 4
test_y_channel: true
Demo 실행
python hat/test.py -opt options/test/[사용할 yml파일 이름].yml
// 예
// python hat/test.py -opt options/test/HAT_SRx4_ImageNet-pretrain.yml

- 결과는 다음과 같이
/HAT/results
경로에 설정한 이름으로 폴더와 함께 생성된다.
Demo 결과
Original image

Resize image

Processed image
