Showing
1 changed file
with
81 additions
and
0 deletions
notebooks/eval.ipynb
0 → 100644
1 | +{ | ||
2 | + "cells": [ | ||
3 | + { | ||
4 | + "cell_type": "code", | ||
5 | + "execution_count": 1, | ||
6 | + "id": "ahead-paste", | ||
7 | + "metadata": {}, | ||
8 | + "outputs": [], | ||
9 | + "source": [ | ||
10 | + "from glob import glob\n", | ||
11 | + "import cv2\n", | ||
12 | + "\n", | ||
13 | + "images = sorted(glob(\"./tennis_test_1080p/*.png\"))" | ||
14 | + ] | ||
15 | + }, | ||
16 | + { | ||
17 | + "cell_type": "code", | ||
18 | + "execution_count": 2, | ||
19 | + "id": "rapid-tension", | ||
20 | + "metadata": {}, | ||
21 | + "outputs": [], | ||
22 | + "source": [ | ||
23 | + "from pathlib import Path\n", | ||
24 | + "Path(\"./dataset/Urban100/x2\").mkdir(parents=True, exist_ok=True)" | ||
25 | + ] | ||
26 | + }, | ||
27 | + { | ||
28 | + "cell_type": "code", | ||
29 | + "execution_count": 3, | ||
30 | + "id": "visible-texas", | ||
31 | + "metadata": {}, | ||
32 | + "outputs": [ | ||
33 | + { | ||
34 | + "name": "stderr", | ||
35 | + "output_type": "stream", | ||
36 | + "text": [ | ||
37 | + "100%|██████████| 125/125 [00:18<00:00, 6.61it/s]\n" | ||
38 | + ] | ||
39 | + } | ||
40 | + ], | ||
41 | + "source": [ | ||
42 | + "from tqdm import tqdm\n", | ||
43 | + "for image in tqdm(images):\n", | ||
44 | + " hr = cv2.imread(image, cv2.IMREAD_COLOR)\n", | ||
45 | + " lr = cv2.resize(hr, dsize=(960, 540), interpolation=cv2.INTER_CUBIC)\n", | ||
46 | + "\n", | ||
47 | + " cv2.imwrite(\"./dataset/Urban100/x2/\" + Path(image).stem + \"_HR.png\", hr)\n", | ||
48 | + " cv2.imwrite(\"./dataset/Urban100/x2/\" + Path(image).stem + \"_LR.png\", lr)" | ||
49 | + ] | ||
50 | + }, | ||
51 | + { | ||
52 | + "cell_type": "code", | ||
53 | + "execution_count": null, | ||
54 | + "id": "fallen-religion", | ||
55 | + "metadata": {}, | ||
56 | + "outputs": [], | ||
57 | + "source": [] | ||
58 | + } | ||
59 | + ], | ||
60 | + "metadata": { | ||
61 | + "kernelspec": { | ||
62 | + "display_name": "Python 3", | ||
63 | + "language": "python", | ||
64 | + "name": "python3" | ||
65 | + }, | ||
66 | + "language_info": { | ||
67 | + "codemirror_mode": { | ||
68 | + "name": "ipython", | ||
69 | + "version": 3 | ||
70 | + }, | ||
71 | + "file_extension": ".py", | ||
72 | + "mimetype": "text/x-python", | ||
73 | + "name": "python", | ||
74 | + "nbconvert_exporter": "python", | ||
75 | + "pygments_lexer": "ipython3", | ||
76 | + "version": "3.7.7" | ||
77 | + } | ||
78 | + }, | ||
79 | + "nbformat": 4, | ||
80 | + "nbformat_minor": 5 | ||
81 | +} |
-
Please register or login to post a comment