Skip to content

Simple version of patchify() #25

@sunchengyi

Description

@sunchengyi

Sorry this is not issue, just some comment. It seems that anomaly_map.patchify() can be simplified as follows

def patchify_new(features):
    """Use AvgPool3d to patchify "features"
    """  
    patch_size = 3
    padding = (patch_size - 1) //2
    return torch.nn.AvgPool3d(
        kernel_size=(1, patch_size, patch_size),
        stride=1,
        padding=(0, padding,padding))(features.unsqueeze(1)).squeeze(1)

Of course, this function can not return the spatial information.
Please feel free to check and use it or just ignore it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions