pyanomaly/core/utils.py
def frame_gradient(x):
    '''
    The input is a video clip and get the gradient on the image 
    Args:
        x: the video with bs. [bs, d, 1, h, w]
    
    Returns:
        dx: [bs, d, 1, h, w] the gradient on x-axis
        dy: [bs, d, 1, h, w] the gradient on y-axis
    '''
    video_length = x.size(1)
    dx = list()
    dy = list()
    for i in range(video_length):
        temp_dx, temp_dy = image_gradient(x[:,i,:,:,:])
        # dx.append(temp_dx.unsqueeze_(1))
        dx.append(temp_dx)
        dy.append(temp_dy)
    
    dx = torch.stack(dx, dim=1)
    dy = torch.stack(dy, dim=1)
    # import ipdb; ipdb.set_trace()
    gradient = dx + dy
    return dx, dy, gradient

    The input is a video clip and get the gradient on the image 
    Args:
        x: the video with bs. [bs, d, 1, h, w]
    
    Returns:
        dx: [bs, d, 1, h, w] the gradient on x-axis
        dy: [bs, d, 1, h, w] the gradient on y-axis
    
The input is a video clip and get the gradient on the image
The input is a video clip and get the gradient on the image
def frame_gradient(x):
    video_length = x.size(1)
    dx = list()
    dy = list()
    for i in range(video_length):
        temp_dx, temp_dy = image_gradient(x[:,i,:,:,:])
        dx.append(temp_dx)
        dy.append(temp_dy)
    dx = torch.stack(dx, dim=1)
    dy = torch.stack(dy, dim=1)
    gradient = dx + dy
    return dx, dy, gradient
def frame_gradient ( x ) : video_length = x . size ( 1 ) dx = list ( ) dy = list ( ) for i in range ( video_length ) : temp_dx , temp_dy = image_gradient ( x [ : , i , : , : , : ] ) dx . append ( temp_dx ) dy . append ( temp_dy ) dx = torch . stack ( dx , dim = 1 ) dy = torch . stack ( dy , dim = 1 ) gradient = dx + dy return dx , dy , gradient
The input is a video clip and get the gradient on the image
The input is a video clip and get the gradient on the image
'''
    The input is a video clip and get the gradient on the image 
    Args:
        x: the video with bs. [bs, d, 1, h, w]
    
    Returns:
        dx: [bs, d, 1, h, w] the gradient on x-axis
        dy: [bs, d, 1, h, w] the gradient on y-axis
    ''' # dx.append(temp_dx.unsqueeze_(1))
 # import ipdb; ipdb.set_trace()

[bs, d, 1, h, w] the gradient on x-axis
dy: [bs, d, 1, h, w] the gradient on y-axis
[ bs d 1 h w ] the gradient on x - axis dy : [ bs d 1 h w ] the gradient on y - axis
dx
x
the video with bs.
the video with bs .