Skip to content

Instantly share code, notes, and snippets.

import keras.backend as K
from keras.optimizers import Optimizer
from keras.legacy import interfaces
class WNAdam(Optimizer):
"""WNAdam optimizer.
Default parameters follow those provided in the original paper.
# Arguments
lr: float >= 0. Learning rate.
beta_1: float, 0 < beta < 1. Generally close to 1.
@mvoelk
mvoelk / elastic_transform.py
Last active November 12, 2020 15:59 — forked from ernestum/elastic_transform.py
Elastic transformation of an image in Python
import numpy as np
from scipy.ndimage.interpolation import map_coordinates
from scipy.ndimage.filters import gaussian_filter
def elastic_transform(image, alpha, sigma, random_state=None):
"""Elastic deformation of images as described in [Simard2003].
.. [Simard2003] Simard, Steinkraus and Platt, "Best Practices for
Convolutional Neural Networks applied to Visual Document Analysis", in
Proc. of the International Conference on Document Analysis and
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mvoelk
mvoelk / google-redirection-remover.user.js
Created January 19, 2018 19:22
Userscript - Remove redirection from google links
// ==UserScript==
// @name Google Redirect Remover
// @namespace Google Redirect Remover
// @description Stop google links from using their tracking redirect
// @version 1.0.0
// @include https://*.google.com/*
// @include https://*.google.de/*
// ==/UserScript==
@mvoelk
mvoelk / resnet-152_keras.py
Last active March 11, 2022 08:06
Resnet-152 pre-trained model in TF Keras 2.x
# -*- coding: utf-8 -*-
import cv2
import numpy as np
from tensorflow.keras.layers import Input, Dense, Conv2D, MaxPool2D, AvgPool2D, Activation
from tensorflow.keras.layers import Layer, BatchNormalization, ZeroPadding2D, Flatten, add
from tensorflow.keras.optimizers import SGD
from tensorflow.keras.models import Model
from tensorflow.keras import initializers