Skip to content

Instantly share code, notes, and snippets.


Bhabani mohapatras

View GitHub Profile
mohapatras / repo_push_github
Created Feb 15, 2020
Push local data to github using git.
View repo_push_github
# Create a new repository on the command line
git init
git add
git commit -m "first commit"
git remote add origin
git push -u origin master
# Push an existing repository from the command line
mohapatras /
Created Jun 21, 2018
Quick Sort implementation in python 3 with last element as pivot.
def partition(A, start, end):
pivot = A[end]
pIndex = start
for i in range(start, len(A)):
if A[i] < pivot:
A[i], A[pIndex] = A[pIndex], A[i]
pIndex += 1
A[pIndex], A[end] = A[end], A[pIndex]
mohapatras /
Last active Apr 4, 2018
Assign before doing any keras operation.
# keras example imports
from keras.models import load_model
## extra imports to set GPU options
import tensorflow as tf
from keras import backend as k
# TensorFlow wizardry
config = tf.ConfigProto()
mohapatras /
Last active Jan 4, 2020
# Resnet50 with grayscale images.
import numpy as np
import warnings
import os
import tensorflow as tf
from keras.layers import Input
from keras import layers
from keras.layers import Dense
from keras.layers import Activation
from keras.layers import Flatten
mohapatras /
Created Mar 23, 2018
check_cuda and cudnn versions ubuntu.
# CUDA version
nvcc --version
which nvcc
# CudaNN version
# Use the output of which nvcc to locate your cuda
cat /usr/include/x86_64-linux-gnu/cudnn_v*.h | grep CUDNN_MAJOR -A 2
# memory growth options for keras and tensorflow.
from keras import backend as K
cfg =
cfg.gpu_options.allow_growth = True
mohapatras / plank_notes
Created Sep 14, 2017 — forked from erogol/plank_notes
Kaggle Plankton Classification winner's approach notes
View plank_notes
- Use %10 for validation with STRATIFIED SAMPLING (my mistake)
- Cyclic Pooling
- Leaky ReLU = max(x, a*x) learned a
- reduces overfitting with a ~= 1/3
- Orthogonal initialization
- Use larger weight decay for larger models since otherwise some layers might diverge
mohapatras /
Last active Jun 12, 2017
Found in a comment by user @tspthomas.
I managed to export a Keras model for Tensorflow Serving (not sure whether it is the official way to do
this). My first trial prior to creating my custom model was to use a trained model available on
Keras such as VGG19.
Here is how I did (I put in separate boxes to help understanding and because I use Jupyter :)):
#Creating the model
import keras.backend as K
mohapatras / 0_reuse_code.js
Created Jun 11, 2017
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
View pins.json
"name": "Plan B",
"latitude": 12.9716,
"longitude": 77.5946
}, {
"name": "Locals",
"latitude": 12.933290,
"longitude": 77.622964
}, {
"name": "Toit",