Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add common losses & regularizers #74

Open
GJBoth opened this issue Mar 3, 2023 · 1 comment
Open

Add common losses & regularizers #74

GJBoth opened this issue Mar 3, 2023 · 1 comment
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@GJBoth
Copy link
Collaborator

GJBoth commented Mar 3, 2023

No description provided.

@GJBoth GJBoth added enhancement New feature or request good first issue Good for newcomers labels Mar 3, 2023
@isildur7
Copy link
Contributor

isildur7 commented Mar 6, 2023

current (working) implementation of TV in 2D and 3D:

def tv2d(params):
    # assuming a (1, H, W, 1) shape
    sy = params[:, 1:, :, :] - params[:, :-1, :, :]
    sx = params[:, :, 1:, :] - params[:, :, :-1, :]

    tvloss = jnp.sqrt((sx**2).sum() + (sy**2).sum() + 1e-8)
    return tvloss
def tv3d(params):
    # assuming a (D, H, W) shape
    sy = params[:, 1:, :] - params[:, :-1, :]
    sx = params[:, :, 1:] - params[:, :, :-1]
    sz = params[1:, :, :] - params[:-1, :, :]

    tvloss = jnp.sqrt((sx**2).sum() + (sy**2).sum() + (sz**2).sum() + 1e-8)
    return tvloss

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants