interpolate_1d¶
- behavenet.plotting.cond_ae_utils.interpolate_1d(interp_type, model, ims_0, latents_0, labels_0, labels_sc_0, mins, maxes, input_idxs, n_frames, crop_type=None, mins_sc=None, maxes_sc=None, crop_kwargs=None, marker_idxs=None, ch=0)[source]¶
Return reconstructed images created by interpolating through latent/label space.
- Parameters:
interp_type (
str) – ‘latents’ | ‘labels’model (
behavenet.modelsobject) – autoencoder modelims_0 (
torch.Tensor) – base images for interpolating labels, of shape (1, n_channels, y_pix, x_pix)latents_0 (
np.ndarray) – base latents of shape (1, n_latents); only two of these dimensions will be changed if interp_type=’latents’labels_0 (
np.ndarray) – base labels of shape (1, n_labels)labels_sc_0 (
np.ndarray) – base scaled labels in pixel space of shape (1, n_labels, y_pix, x_pix)mins (
array-like) – minimum values of all labels/latentsmaxes (
array-like) – maximum values of all labels/latentsinput_idxs (
array-like) – indices of labels/latents that will be interpolatedn_frames (
int) – number of interpolation points between mins and maxes (inclusive)crop_type (
strorNoneType, optional) – currently only implements ‘fixed’; if not None, cropped images are returned, and returned labels are also cropped so that they can be plotted on top of the cropped images; if None, returned cropped images are empty and labels are relative to original image sizemins_sc (
list, optional) – min values of scaled labels that correspond to min values of labels when using conditional encodersmaxes_sc (
list, optional) – max values of scaled labels that correspond to max values of labels when using conditional encoderscrop_kwargs (
dict, optional) – define center and extent of crop if crop_type=’fixed’; keys are ‘x_0’, ‘x_ext’, ‘y_0’, ‘y_ext’marker_idxs (
list, optional) – indices of labels_sc_0 that will be interpolated; note that this is analogous but different from input_idxs, since the 2d tensor labels_sc_0 has half as many label dimensions as latents_0 and labels_0ch (
int, optional) – specify which channel of input images to return (can only be a single value)
- Returns:
ims_list (
listoflistofnp.ndarray) interpolated imageslabels_list (
listoflistofnp.ndarray) interpolated labelsims_crop_list (
listoflistofnp.ndarray) interpolated , cropped images
- Return type:
tuple