Closed 11lucky111 closed 1 year ago
The specific code block is:
'''data visualization'''
skip_load = 1 # adjust this to skip through records
# fetch & parse
for _ in range(skip_load):
d, _ = sess.run(data)
ctx_frames = d.query.context.frames
ctx_poses = d.query.context.cameras
tgt_frame = d.target
tgt_pose = d.query.query_camera
tuple_length = ctx_size + 1 # context points + 1 target
print(">>> Context frames:\t%s" % (ctx_frames.shape, ))
print(">>> Context poses: \t%s" % (ctx_poses.shape, ))
print(">>> Target frame: \t%s" % (tgt_frame.shape, ))
print(">>> Target pose: \t%s" % (tgt_pose.shape, ))
# visualization constants
MAX_COLS_PER_ROW = 6
TILE_HEIGHT, TILE_WIDTH, TILE_PAD = 3.0, 3.0, 0.8
np.set_printoptions(precision=2, suppress=True)
# visualize all data tuples in the batch
for n in range(batch_size):
# define image grid
ncols = int(np.min([tuple_length, MAX_COLS_PER_ROW]))
nrows = int(np.ceil(tuple_length / MAX_COLS_PER_ROW))
fig = plt.figure(figsize=(TILE_WIDTH * ncols, TILE_HEIGHT * nrows))
grid = ImageGrid(
fig, 111, # similar to subplot(111)
nrows_ncols=(nrows, ncols),
axes_pad=TILE_PAD, # pad between axes in inch.
)
# visualize context
for ctx_idx in range(ctx_size):
rgb = ctx_frames[n, ctx_idx]
pose = ctx_poses[n, ctx_idx]
caption = "ctx: %02d\nxyz:%s\nyp:%s" % \
(ctx_idx + 1, pose[0:3], pose[3:])
grid[ctx_idx].imshow(rgb)
grid[ctx_idx].set_title(caption, loc='center')
# visualize target
rgb = tgt_frame[n]
pose = tgt_pose[n]
caption = "target\nxyz:%s\nyp:%s" % \
(pose[0:3], pose[3:])
grid[-1].imshow(rgb)
grid[-1].set_title(caption, loc='center')
plt.show()
I've already fixed it because the training set was misplaced.
When I run Jupyter Notebooks,“view_interpolation”file, I get:
KernelRestarter: restarting kernel (1/5), keep random ports WARNING:root:kernel 082ad86c-b043-4ea7-8110-2bf7b45ad159 restarted