MCPcopy Create free account

hub / github.com/NVlabs/imaginaire / functions

Functions1,077 in github.com/NVlabs/imaginaire

↓ 72 callersFunctiontensor2im
r"""Convert tensor to image. Args: image_tensor (torch.tensor or list of torch.tensor): If tensor then (NxCxHxW) or (NxTxCxHx
imaginaire/utils/visualization/common.py:72
↓ 63 callersMethodsum
r"""Sum all elements recursively in a nested list. Args: x (nested list of int): Input list of elements. Returns:
imaginaire/generators/fs_vid2vid.py:859
↓ 57 callersMethodworld2local
(self, v, is_vec=False)
imaginaire/model_utils/gancraft/mc_utils.py:223
↓ 40 callersFunctionconv
(use_batch_norm, in_planes, out_planes, kernel_size=3, stride=1)
imaginaire/third_party/flow_net/flownet2/networks/submodules.py:12
↓ 30 callersMethodapply
(module, weight_name, bias_name, lr_mul, equalized)
imaginaire/layers/weight_norm.py:93
↓ 30 callersMethodeval
r"""Produce output given segmentation and other conditioning inputs. random style will be used if neither z nor style_img is provided.
imaginaire/trainers/gancraft.py:45
↓ 27 callersMethodnorm
(self, t)
imaginaire/third_party/flow_net/flow_net.py:88
↓ 23 callersFunctionis_master
r"""check if current process is the master
imaginaire/utils/distributed.py:60
↓ 20 callersMethodapply_ops
r"""Apply any ops from op_dict to data types. Args: data (dict): Dict containing data_type as key, with each value
imaginaire/datasets/base.py:407
↓ 19 callersMethod__init__
(self, in_features, out_features, bias=True, weight_norm_type='none', weight_norm_params=None
imaginaire/layers/conv.py:423
↓ 18 callersFunctionget_paired_input_image_channel_number
r"""Get number of channels for the input image. Args: data_cfg (obj): Data configuration structure. Returns: num_channels (in
imaginaire/utils/data.py:518
↓ 18 callersFunctionpredict_flow
(in_planes)
imaginaire/third_party/flow_net/flownet2/networks/submodules.py:65
↓ 16 callersMethod__init__
(self, in_channels, out_channels, kernel_size=3, stride=1, padding=1, dilation=1, groups=1, b
imaginaire/layers/residual.py:428
↓ 15 callersMethod_get_save_path
r"""Get the image save path. Args: subdir (str): Sub-directory under the main directory for saving the outputs.
imaginaire/trainers/base.py:565
↓ 15 callersFunctionis_local_master
()
imaginaire/utils/distributed.py:65
↓ 14 callersFunctiondeconv
(in_planes, out_planes)
imaginaire/third_party/flow_net/flownet2/networks/submodules.py:70
↓ 12 callersMethod_time_before_loss
r""" Record time before computing loss.
imaginaire/trainers/base.py:884
↓ 12 callersMethodget_num_filters
r"""Get the number of filters at current layer. Args: num_downsamples (int) : How many downsamples at current layer. Retu
imaginaire/generators/vid2vid.py:27
↓ 12 callersFunctionget_paired_input_label_channel_number
r"""Get number of channels for the input label map. Args: data_cfg (obj): Data configuration structure. video (bool): Whether we
imaginaire/utils/data.py:536
↓ 12 callersFunctionget_rank
r"""Get rank of the thread.
imaginaire/utils/distributed.py:30
↓ 11 callersFunctioncompute_fid
r"""Compute the fid score. Args: fid_path (str): Location for the numpy file to store or to load the statistics. data
imaginaire/evaluation/fid.py:16
↓ 11 callersFunctionload_or_compute_activations
r"""Load mean and covariance from saved npy file if exists. Otherwise, compute the mean and covariance. Args: act_path (str or None):
imaginaire/evaluation/common.py:565
↓ 11 callersMethodread
(self, key)
imaginaire/datasets/cache.py:30
↓ 10 callersMethoddecode
r"""Decode content and style code to an image. Args: content (Tensor): Content code. style (Tensor): Style code.
imaginaire/generators/munit.py:280
↓ 10 callersMethodencode
r"""Encode an image to content and style code. Args: images (Tensor): Input images. Returns: (tuple):
imaginaire/generators/munit.py:266
↓ 10 callersFunctionget_neighbor_height
(heightmap, loc0, loc1, minheight, neighbor_size=7)
imaginaire/model_utils/gancraft/camctl.py:437
↓ 10 callersMethodstep
r"""Performs a single optimization step. Args: closure (callable, optional): A closure that reevaluates the model
imaginaire/optimizers/madam.py:18
↓ 9 callersFunction_sqn
r"""Squared norm.
imaginaire/evaluation/kid.py:314
↓ 9 callersMethod_write_to_meters
r"""Write values to meters.
imaginaire/trainers/base.py:216
↓ 9 callersFunctionget_world_size
r"""Get world size. How many GPUs are available in this job.
imaginaire/utils/distributed.py:39
↓ 9 callersFunctionresample
r"""Resamples an image using the provided flow. Args: image (NxCxHxW tensor) : Image to resample. flow (Nx2xHxW tensor) : Optical
imaginaire/model_utils/fs_vid2vid.py:12
↓ 9 callersFunctiontensor2flow
r"""Convert flow tensor to color image. Args: tensor (tensor) of If tensor then (NxCxHxW) or (NxTxCxHxW) or (CxHxW). imty
imaginaire/utils/visualization/common.py:158
↓ 9 callersFunctionto_cuda
r"""Move all tensors inside data to gpu. Args: data (dict, list, or tensor): Input data.
imaginaire/utils/misc.py:73
↓ 9 callersFunctionupfirdn2d
r"""Pad, upsample, filter, and downsample a batch of 2D images. Performs the following sequence of operations for each channel: 1. Upsample
imaginaire/third_party/upfirdn2d/upfirdn2d.py:193
↓ 9 callersFunctionweights_init
r"""Initialize weights in the network. Args: init_type (str): The name of the initialization scheme. gain (float): The parameter
imaginaire/utils/init_weight.py:9
↓ 9 callersMethodwrite
r"""Record the value
imaginaire/utils/meters.py:99
↓ 8 callersMethod__init__
(self, dim=-1, learned_scale=True, eps=1e-5)
imaginaire/layers/activation_norm.py:481
↓ 8 callersMethodcompute_gan_losses
r"""Compute GAN loss and feature matching loss. Args: net_D_output (dict): Output of the discriminator. dis_update (b
imaginaire/trainers/vid2vid.py:656
↓ 8 callersMethodgglbl2ggid
(self, gglbl)
imaginaire/model_utils/gancraft/mc_utils.py:321
↓ 8 callersMethodvisualize_label
r"""Visualize the input label when saving to image. Args: label (tensor): Input label tensor.
imaginaire/trainers/vid2vid.py:789
↓ 7 callersMethod__init__
(self)
imaginaire/evaluation/pretrained.py:41
↓ 7 callersMethod_flush_meters
r"""Flush all meters using the current iteration.
imaginaire/trainers/base.py:224
↓ 7 callersMethod_get_height
(self, loc0, loc1, minheight)
imaginaire/model_utils/gancraft/camctl.py:257
↓ 7 callersFunctionget_and_setattr
r"""Get attribute with default choice. If attribute does not exist, set it using the default value. Args: cfg (obj) : Config options.
imaginaire/utils/misc.py:163
↓ 7 callersMethodlog
(self, string)
imaginaire/third_party/flow_net/flownet2/utils/tools.py:50
↓ 7 callersMethodperform_augmentation
r"""Perform data augmentation on images only. Args: data (dict): Keys are from data types. Values can be numpy.ndarray
imaginaire/datasets/base.py:339
↓ 7 callersMethodreshape_weight
r"""Reshape input x to the desired weight shape. Args: x (tensor or list of tensors): Input features. weight_shape (l
imaginaire/generators/fs_vid2vid.py:788
↓ 6 callersMethod__init__
(self, embed_dim: int, # vision image_resolution: int,
imaginaire/evaluation/caption/clip.py:365
↓ 6 callersMethod_get_outputs
r"""Return output values. Note that when the gan mode is relativistic. It will do the difference before returning. Args: n
imaginaire/trainers/base.py:582
↓ 6 callersMethod_get_total_loss
r"""Return the total loss to be backpropagated. Args: gen_forward (bool): If ``True``, backpropagates the generator loss,
imaginaire/trainers/base.py:851
↓ 6 callersFunction_parse_scaling
(scaling)
imaginaire/third_party/upfirdn2d/upfirdn2d.py:20
↓ 6 callersFunctionapply_diff_aug
r"""Applies differentiable augmentation. Args: data (dict): Input data. keys (list of str): Keys to the data values that we want t
imaginaire/utils/diff_aug.py:14
↓ 6 callersFunctionconcat_frames
r"""Concat previous and current frames and only keep the latest $(n_frames). If concatenated frames are longer than $(n_frames), drop the oldest o
imaginaire/model_utils/fs_vid2vid.py:405
↓ 6 callersFunctioncrop_and_resize
r"""Crop the image using the given coordinates and resize to target size. Args: img (tensor or list of tensors): Input image. coo
imaginaire/model_utils/fs_vid2vid.py:320
↓ 6 callersFunctiondist_all_gather_tensor
r""" gather to all ranks
imaginaire/utils/distributed.py:108
↓ 6 callersMethodfiltfilt
(self, height_history, decay=0.2)
imaginaire/model_utils/gancraft/camctl.py:270
↓ 6 callersFunctionget_activation_norm_layer
r"""Return an activation normalization layer. Args: num_features (int): Number of feature channels. norm_type (str):
imaginaire/layers/activation_norm.py:568
↓ 6 callersFunctioni_conv
(use_batch_norm, in_planes, out_planes, kernel_size=3, stride=1, bias=True)
imaginaire/third_party/flow_net/flownet2/networks/submodules.py:36
↓ 6 callersFunctionsplit_labels
r"""Split concatenated labels into their parts. Args: labels (torch.Tensor): Labels obtained through concatenation. label_lengths
imaginaire/utils/misc.py:14
↓ 6 callersMethodto_tensor
r"""Convert all images to tensor. Args: data (dict): Dict containing data_type as key, with each value as a list
imaginaire/datasets/base.py:384
↓ 5 callersMethod__init__
(self, input_dim, output_dim, latent_dim,
imaginaire/generators/funit.py:372
↓ 5 callersMethod__init__
(self, in_channels, style_dim, out_channels_c=3, hidden_channels=256, leaky_relu=True)
imaginaire/generators/gancraft_base.py:132
↓ 5 callersMethod__init__
(self, args, use_batch_norm=False, div_flow=20.)
imaginaire/third_party/flow_net/flownet2/models.py:21
↓ 5 callersFunction_parse_padding
(padding)
imaginaire/third_party/upfirdn2d/upfirdn2d.py:30
↓ 5 callersFunctiondownload_file_from_google_drive
r"""Download a file from google drive. Args: URL: GDrive file ID. destination: Path to save the file. Returns:
imaginaire/utils/io.py:48
↓ 5 callersFunctiondraw_edges
r"""Draw all the edges in the edge list on the canvas. Args: canvas (HxWxK numpy array): Canvas to draw. keypoints (Px2 numpy arr
imaginaire/utils/visualization/pose.py:236
↓ 5 callersFunctionget_fg_mask
r"""Obtain the foreground mask for pose sequences, which only includes the human. This is done by looking at the body part map from DensePose.
imaginaire/model_utils/fs_vid2vid.py:436
↓ 5 callersMethodget_label_lengths
r"""Get num channels of all labels to be concated. Returns: label_lengths (OrderedDict): Dict mapping image data_type to num
imaginaire/datasets/paired_videos.py:41
↓ 5 callersMethodload_checkpoint
r"""Load network weights, optimizer parameters, scheduler parameters from a checkpoint. Args: cfg (obj): Global configura
imaginaire/trainers/base.py:247
↓ 5 callersFunctionrequires_grad
r""" Set a model to require gradient or not. Args: model (nn.Module): Neural network model. require (bool): Whether the network r
imaginaire/utils/misc.py:39
↓ 5 callersMethodreset_renderer
r"""Reset the renderer. Args: is_flipped_input (bool): Is the input sequence left-right flipped?
imaginaire/generators/wc_vid2vid.py:70
↓ 5 callersMethodset_inference_sequence_idx
r"""Get frames from this sequence during inference. Args: index (int): Index of inference sequence.
imaginaire/datasets/paired_videos.py:68
↓ 5 callersFunctionset_random_seed
r"""Set random seeds for everything. Args: seed (int): Random seed. by_rank (bool):
imaginaire/utils/trainer.py:20
↓ 5 callersFunctiontensor2label
r"""Convert segmentation mask tensor to color image. Args: segmap (tensor) of If tensor then (NxCxHxW) or (NxTxCxHxW) or (CxHxW).
imaginaire/utils/visualization/common.py:110
↓ 5 callersFunctionto_device
r"""Move all tensors inside data to device. Args: data (dict, list, or tensor): Input data. device (str): 'cpu' or 'cuda'.
imaginaire/utils/misc.py:53
↓ 4 callersMethod__init__
(self, gen_cfg, data_cfg)
imaginaire/generators/fs_vid2vid.py:32
↓ 4 callersMethod__init__
(self, input_dim, output_dim, latent_dim, num_layers, norm, nonlinearity)
imaginaire/generators/munit.py:443
↓ 4 callersMethod__init__
(self)
imaginaire/evaluation/lpips.py:78
↓ 4 callersMethod_assign_criteria
r"""Assign training loss terms. Args: name (str): Loss name criterion (obj): Loss object. weight (float):
imaginaire/trainers/vid2vid.py:74
↓ 4 callersFunction_get_filter_size
(f)
imaginaire/third_party/upfirdn2d/upfirdn2d.py:42
↓ 4 callersMethod_get_height
(self, loc0, loc1, minheight)
imaginaire/model_utils/gancraft/camctl.py:386
↓ 4 callersMethod_make_layer
(self, planes, blocks, stride=1)
imaginaire/evaluation/caption/clip.py:236
↓ 4 callersMethodbackward
(ctx, dy)
imaginaire/third_party/bias_act/bias_act.py:132
↓ 4 callersMethoddecode
r"""Generate images by combining their content and style codes. Args: content (tensor): Content code tensor. style (t
imaginaire/generators/funit.py:155
↓ 4 callersMethoddecode
r"""Generate images by combining their content and style codes. Args: content (tensor): Content code tensor. style (t
imaginaire/generators/coco_funit.py:178
↓ 4 callersFunctiondraw_edge
r"""Set colors given a list of x and y coordinates for the edge. Args: im (HxWxC numpy array): Canvas to draw. x (1D numpy array)
imaginaire/utils/visualization/face.py:390
↓ 4 callersFunctionextract_valid_pose_labels
r"""Remove some labels (e.g. face regions) in the pose map if necessary. Args: pose_map (3D, 4D or 5D tensor): Input pose map. po
imaginaire/model_utils/fs_vid2vid.py:522
↓ 4 callersMethodforward
r"""Discriminator forward. Args: data (dict): Input data. net_G_output (dict): Generator output. past_fra
imaginaire/discriminators/fs_vid2vid.py:58
↓ 4 callersMethodgen_frames
r"""Generate a sequence of frames given a sequence of data. Args: data (dict): Training data at the current iteration.
imaginaire/trainers/vid2vid.py:425
↓ 4 callersFunctionget_checkpoint
r"""Get the checkpoint path. If it does not exist yet, download it from the url. Args: checkpoint_path (str): Checkpoint path.
imaginaire/utils/io.py:112
↓ 4 callersFunctionget_model_optimizer_and_scheduler
r"""Return the networks, the optimizers, and the schedulers. We will first set the random seed to a fixed value so that each GPU copy will be
imaginaire/utils/trainer.py:66
↓ 4 callersFunctionget_nonlinearity_layer
r"""Return a nonlinearity layer. Args: nonlinearity_type (str): Type of nonlinear activation function. ``'none'``
imaginaire/layers/nonlinearity.py:30
↓ 4 callersFunctionget_trainer
Return the trainer object. Args: cfg (Config): Loaded config object. net_G (obj): Generator network object. net_D (obj):
imaginaire/utils/trainer.py:37
↓ 4 callersMethodone_up_conv_layer
r"""One residual block layer in the main branch. Args: x (4D tensor) : Current feature map. encoded_label (list of tens
imaginaire/generators/vid2vid.py:275
↓ 4 callersFunctionpick_image
r"""Pick the image among images according to idx. Args: images (B x N x C x H x W tensor or list of tensors) : N images. idx (B t
imaginaire/model_utils/fs_vid2vid.py:75
↓ 4 callersMethodpost_process
r"""Do any postprocessing of the data / output here. Args: data (dict): Training data at the current iteration. net_G
imaginaire/trainers/vid2vid.py:224
↓ 4 callersFunctionrandom_shift
r"""Randomly shift the input tensor. Args: x (4D tensor): The input batch of images. offset (int): The maximum offset ratio that
imaginaire/utils/misc.py:216
↓ 4 callersMethodsave_image
r"""Compute visualization images and save them to the disk. Args: path (str): Location of the file. data (dict): Data
imaginaire/trainers/base.py:530
↓ 4 callersMethodset_sequence_length
r"""Set the length of sequence you want as output from dataloader. Args: sequence_length (int): Length of output sequences.
imaginaire/datasets/paired_videos.py:80
↓ 3 callersMethod__init__
(self, dis_cfg, data_cfg)
imaginaire/discriminators/multires_patch.py:28
next →1–100 of 1,077, ranked by callers