diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2018-06-25 18:17:41 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2018-06-25 18:17:41 +0200 |
| commit | c325a63c35b91a315077161df318bb45a49ee69f (patch) | |
| tree | f126ebb468c6dc566242333e33145f5dbd69366b | |
| parent | bdbd5ea51faedfb6b87de52df6d16338b3ffe363 (diff) | |
process sequences
| -rw-r--r-- | run.py | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -57,7 +57,6 @@ tensorOutput = torch.FloatTensor() index = 0 def recurse_two_frames(moduleNetwork, tensorOutput, a_np, b_np, frame_index, morph_index, step, depth=0): - step /= 2 print("generate {} {} {}".format(frame_index, morph_index, step)) tensorInputFirst = torch.FloatTensor(a_np) @@ -70,14 +69,14 @@ def recurse_two_frames(moduleNetwork, tensorOutput, a_np, b_np, frame_index, mor middle_img = (numpy.rollaxis(middle_np, 0, 3)[:,:,::-1] * 255.0).astype(numpy.uint8) return middle_img if morph_index > frame_index: - next_index = frame_index - (step/2) + next_index = frame_index - (step/4) next_a_np = a_np next_b_np = middle_np else: - next_index = frame_index + (step/2) + next_index = frame_index + (step/4) next_a_np = middle_np next_b_np = b_np - return recurse_two_frames(moduleNetwork, tensorOutput, next_a_np, next_b_np, frame_index, next_index, step, depth+1) + return recurse_two_frames(moduleNetwork, tensorOutput, next_a_np, next_b_np, frame_index, next_index, step/2, depth+1) def recurse_videos(moduleNetwork, tensorOutput, a, b, a_offset, b_offset, count, step, frame_index): global index @@ -90,7 +89,7 @@ def recurse_videos(moduleNetwork, tensorOutput, a, b, a_offset, b_offset, count, print("{} => {}".format(a_fn, b_fn)) a_np = load_image(a_fn) b_np = load_image(b_fn) - frame = recurse_two_frames(moduleNetwork, tensorOutput, a_np, b_np, frame_index, count / 2, count / 4) + frame = recurse_two_frames(moduleNetwork, tensorOutput, a_np, b_np, frame_index, count / 2, count / 2) if step < 2: return [frame] else: |
