MCPcopy
hub / github.com/ali-vilab/AnyDoor / vis_sample

Function vis_sample

run_dataset_debug.py:38–52  ·  view source on GitHub ↗
(item)

Source from the content-addressed store, hash-verified

36
37
38def vis_sample(item):
39 ref = item['ref']* 255
40 tar = item['jpg'] * 127.5 + 127.5
41 hint = item['hint'] * 127.5 + 127.5
42 step = item['time_steps']
43 print(ref.shape, tar.shape, hint.shape, step.shape)
44
45 ref = ref[0].numpy()
46 tar = tar[0].numpy()
47 hint_image = hint[0, :,:,:-1].numpy()
48 hint_mask = hint[0, :,:,-1].numpy()
49 hint_mask = np.stack([hint_mask,hint_mask,hint_mask],-1)
50 ref = cv2.resize(ref.astype(np.uint8), (512,512))
51 vis = cv2.hconcat([ref.astype(np.float32), hint_image.astype(np.float32), hint_mask.astype(np.float32), tar.astype(np.float32) ])
52 cv2.imwrite('sample_vis.jpg',vis[:,:,::-1])
53
54
55dataloader = DataLoader(dataset, num_workers=8, batch_size=4, shuffle=True)

Callers 1

Calls 1

printFunction · 0.85

Tested by

no test coverage detected