Skip to content

Commit

Permalink
try fixing ruff errors
Browse files Browse the repository at this point in the history
  • Loading branch information
pifroggi authored Aug 22, 2024
1 parent 8ea4040 commit d9b97e9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions backend/src/nodes/impl/pytorch/rife/IFNet_HDv3_v4_14_align.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def align_images(
flow2=None, # noqa: ANN001
img1_blurred=None # noqa: ANN001
):
def compute_flow(img0_blurred, img1_blurred, timestep):
def compute_flow(img0_blurred: np.ndarray, img1_blurred: np.ndarray, timestep: float) -> None:
f0 = self.encode(img0_blurred[:, :3])
f1 = self.encode(img1_blurred[:, :3])
flow = None
Expand Down Expand Up @@ -240,14 +240,14 @@ def compute_flow(img0_blurred, img1_blurred, timestep):
flow2 = compute_flow(img1_blurred, img1_blurred, timestep)

# subtract flow2 from flow1 to compensate for shifts
new_flow = flow1 - flow2
compensated_flow = flow1 - flow2

# warp original unblurred image with the new flow
aligned_img0 = warp(img0, new_flow[:, :2], device)
# warp image with the compensated flow
aligned_img0 = warp(img0, compensated_flow[:, :2], device)

# add clamp here instead of in warplayer script, as it changes the output there
aligned_img0 = aligned_img0.clamp(0, 1)
return aligned_img0, new_flow, flow2, img1_blurred
return aligned_img0, compensated_flow, flow2, img1_blurred

def forward(
self,
Expand Down

0 comments on commit d9b97e9

Please sign in to comment.