D4RT's decoder is a small cross-attention transformer. Each query becomes one token: the Fourier feature embedding of is added to learned embeddings of the three timesteps, and the token is augmented with an embedding of the local RGB patch of the source frame centred at . Build that token.
fourier_features(u, v, n_freq) returns a 1-D array of length 4 * n_freq:
local_patch(frame, u, v, size=9) returns the (size, size, 3) patch of frame (shape (H, W, 3)) centred on the pixel that contains : column , row . size is odd. Positions outside the frame are filled with zeros.
query_token(query, video, params, n_freq, size=9) returns the token, a 1-D array of length d:
query is (u, v, t_src, t_tgt, t_cam) with frames numbered from 1. video has shape (T, H, W, 3).params is a dict: "W_fourier" of shape (d, 4 * n_freq), "E_src", "E_tgt", "E_cam" of shape (T, d) (row 0 is frame 1), "W_patch" of shape (d, size * size * 3).The paper fixes the ingredients; the number of frequencies, the layout above, the two linear maps and the zero padding are conventions of this problem.