Skip to content

Instantly share code, notes, and snippets.

View titu1994's full-sized avatar

Somshubra Majumdar titu1994

View GitHub Profile
from keras import backend as K
from keras.regularizers import ActivityRegularizer
dummy_loss_val = K.variable(0.0)
# Dummy loss function which simply returns 0
# This is because we will be training the network using regularizers.
def dummy_loss(y_true, y_pred):
return dummy_loss_val
@titu1994
titu1994 / cifar10.py
Last active February 2, 2017 06:49
weights conversion
from __future__ import print_function
import densenet
import numpy as np
import sklearn.metrics as metrics
from keras.datasets import cifar10
from keras.utils import np_utils
from keras.preprocessing.image import ImageDataGenerator
from keras.optimizers import Adam
@titu1994
titu1994 / mobilenet_v1.py
Last active June 30, 2017 20:36
Tensorflow MobileNet 224 1.0 checkpoint execution
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@titu1994
titu1994 / imdb_sru.py
Last active September 12, 2017 03:56
Incorrect, partial implementation of SimpleRecurrentUnit from the paper
'''Trains an SRU model on the IMDB sentiment classification task.
The dataset is actually too small for LSTM to be of any advantage
compared to simpler, much faster methods such as TF-IDF + LogReg.
Notes:
- RNNs are tricky. Choice of batch size is important,
choice of loss and optimizer is critical, etc.
Some configurations won't converge.
- LSTM loss decrease patterns during training can be quite different
from what you see with CNNs/MLPs/etc.
'''
@titu1994
titu1994 / conv_auto_encoder.py
Last active January 23, 2018 17:09
Attempt at implementing a smaller version of "Image Restoration Using Convolutional Auto-encoders with Symmetric Skip Connections"(http://arxiv.org/abs/1606.08921)
from keras.models import Model
from keras.layers import Input
from keras.layers.convolutional import Convolution2D
from keras.layers.convolutional import Deconvolution2D
from keras.layers import merge
import numpy as np
'''
Attempt at implementing a smaller version of "Image Restoration Using Convolutional Auto-encoders with Symmetric Skip Connections"
(http://arxiv.org/abs/1606.08921)
@titu1994
titu1994 / eager_janet.ipynb
Created April 24, 2018 02:16
TF Eager JANet model
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@titu1994
titu1994 / long-audio-transcription-citrinet.ipynb
Last active May 6, 2021 22:29
Long-audio-transcription-Citrinet.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@titu1994
titu1994 / PortraitStyleTransfer.py
Last active May 11, 2021 06:32
Partial implementation of "Painting Style Transfer for Head Portraits using Convolutional Neural Networks".
from scipy.misc import imread, imresize, imsave
from scipy.optimize import fmin_l_bfgs_b
import numpy as np
import time
import os
import argparse
import h5py
from keras.models import Sequential
from keras.layers.convolutional import Convolution2D, ZeroPadding2D, AveragePooling2D, MaxPooling2D
import numpy as np
import numba
from typing import List, Tuple
W_INS = 2
W_INS_NON = 0
W_DEL = 2
W_DEL_NON = 0
W_SUB = 1
W_MATCH = -2
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.