CUST / basicsr /inference_img /random_img_maker.py
jsookim's picture
Upload 181 files
5528edf verified
Raw
History Blame Contribute Delete
1.09 kB
import cv2
import numpy as np
import os
def create_inference_test_data(num_images=50):
base_dir = 'inference_test'
# ๋ชฉํ‘œ ํ•ด์ƒ๋„ ์„ค์ • (LR ๊ธฐ์ค€)
# x2: 1280x720 -> 640x360
# x3: 1281x720 -> 427x240
# x4: 1280x720 -> 320x180
target_sizes = {
'x2': (640, 360),
'x3': (427, 240),
'x4': (320, 180)
}
print("Inference ํ…Œ์ŠคํŠธ์šฉ ๋ฐ์ดํ„ฐ ์ƒ์„ฑ ์ค‘...")
for scale, (w, h) in target_sizes.items():
save_path = os.path.join(base_dir, scale)
os.makedirs(save_path, exist_ok=True)
for i in range(1, num_images + 1):
# ๋žœ๋ค ๋…ธ์ด์ฆˆ ์ด๋ฏธ์ง€ ์ƒ์„ฑ (H, W, C)
img = np.random.randint(0, 256, (h, w, 3), dtype=np.uint8)
# ์ €์žฅ
cv2.imwrite(os.path.join(save_path, f'test_{i:03d}.png'), img)
print(f"[{scale}] {w}x{h} ์ด๋ฏธ์ง€ {num_images}์žฅ ์ƒ์„ฑ ์™„๋ฃŒ.")
print(f"\n๋ชจ๋“  ๋ฐ์ดํ„ฐ๊ฐ€ '{base_dir}' ํด๋”์— ์ค€๋น„๋˜์—ˆ์Šต๋‹ˆ๋‹ค.")
if __name__ == "__main__":
create_inference_test_data(50)