Skip to content

Commit 21cc9a4

Browse files
changed algorithm for difference generation to a much faster one
1 parent fd94ca1 commit 21cc9a4

15 files changed

+47
-39
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
venv
22
main.build
33
dist
4+
test
5+
1x-WB-Denoise.pth
6+
test.py
-1.29 KB
Binary file not shown.

differ/differ_gen.py

Lines changed: 0 additions & 31 deletions
This file was deleted.

main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import argparse
22
import multiprocessing
33
import sys
4-
from differ.differ import Difference
4+
from src.differ import Difference
55

66

77
def parse() -> argparse.Namespace:

requirements.txt

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
blend_modes==2.2.0
2-
numpy==2.2.0
3-
opencv-python==4.10.0.84
4-
pillow==11.0.0
5-
pycuda==2024.1.2
6-
torch==2.5.1
7-
tqdm==4.67.1
1+
numpy>=2.2.0
2+
opencv-python>=4.10.0.84
3+
pillow>=11.0.0
4+
pycuda>=2024.1.2
5+
torch>=2.5.1
6+
tqdm>=4.67.1
7+
imageio>=2.36.1
8+
nuitka>=2.5.8
1.08 KB
Binary file not shown.
File renamed without changes.
File renamed without changes.

src/differ_gen.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import os
2+
import numpy as np
3+
from queue import Queue
4+
import imageio.v3 as imio3
5+
6+
class DifferGen:
7+
def __init__(self, temp_dir: str) -> None:
8+
"""
9+
class DifferGen requires Temporary Directory path as an Initialization Variable
10+
"""
11+
self.tdir = temp_dir
12+
13+
def run(self, imgs: list, queue: Queue) -> None:
14+
for img in imgs:
15+
bt, tp = os.path.join(self.tdir, "bottom", img), os.path.join(self.tdir, "top", img)
16+
# bottom_raw = Image.open(bt).convert("RGBA")
17+
# top_raw = Image.open(tp).convert("RGBA")
18+
#
19+
# bottom_npy = numpy.array(bottom_raw)
20+
# top_npy = numpy.array(top_raw)
21+
#
22+
# bottom_fl = bottom_npy.astype(float)
23+
# top_fl = top_npy.astype(float)
24+
#
25+
# diff_fl = difference(bottom_fl, top_fl, 1)
26+
# diff_npy = numpy.uint8(diff_fl)
27+
# diff_raw = Image.fromarray(diff_npy)
28+
#
29+
# diff_raw.save(os.path.join(self.tdir, "diff", img))
30+
31+
bottom, top = np.int16(imio3.imread(bt)), np.int16(imio3.imread(tp))
32+
diff = np.uint8(np.abs(bottom - top))
33+
imio3.imwrite(os.path.join(self.tdir, "diff", img), diff)
34+
35+
queue.put(0)
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)