diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2018-06-25 18:12:23 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2018-06-25 18:12:23 +0200 |
| commit | b5cb2dab354ba999c2dc5de7ec820997535cb3ed (patch) | |
| tree | 3f8d23a6864623a55156285b9b191be7864519ca /run.py | |
| parent | 1aea4a9d637fd570665d7bab4fb11b28c5c5a0f6 (diff) | |
process sequences
Diffstat (limited to 'run.py')
| -rw-r--r-- | run.py | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -61,9 +61,9 @@ def recurse_two_frames(moduleNetwork, tensorOutput, a_np, b_np, frame_index, mor tensorInputFirst = torch.FloatTensor(a_np) tensorInputSecond = torch.FloatTensor(b_np) + print("{} {}".format(tensorInputFirst.size(1), tensorInputSecond.size(1))) process(moduleNetwork, tensorInputFirst, tensorInputSecond, tensorOutput) middle_np = tensorOutput.clamp(0.0, 1.0).numpy() - middle_img = (numpy.rollaxis(middle_np, 0, 3)[:,:,::-1] * 255.0).astype(numpy.uint8) if morph_index == frame_index: print("frame {}, depth {}".format(frame_index, depth)) @@ -126,8 +126,10 @@ def store_frames(frames, outputPath): for frame in frames: writer.write_frame(frame) writer.write_frame(inputSecond) + def load_image(path): return numpy.rollaxis(numpy.asarray(PIL.Image.open(path))[:,:,::-1], 2, 0).astype(numpy.float32) / 255.0 + def load_image_tensor(path): return torch.FloatTensor(load_image(path)) |
