Skip to content

Instantly share code, notes, and snippets.


Bhabani mohapatras

  • Emage Vision India
  • Bangalore, India
View GitHub Profile
mohapatras /
Created May 13, 2022 23:33 — forked from twolodzko/
Use Youden index to determine cut-off for classification
import numpy as np
from sklearn.metrics import roc_curve
def sensivity_specifity_cutoff(y_true, y_score):
'''Find data-driven cut-off for classification
Cut-off is determied using Youden's index defined as sensitivity + specificity - 1.
mohapatras /
Created February 15, 2022 05:23 — forked from espoirMur/
How I fix this issue NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running

I had many driver installed I my virtual machine , so It was actually the reason why I was having the error.

To fix it I had first to remove all driver I have installed before using :

  • sudo apt-get purge nvidia-*
  • sudo apt-get update -sudo apt-get autoremove

After that I when a head and installed the latest version of it nvidia driver:

I did :

mohapatras /
Created October 15, 2021 03:31 — forked from kmhofmann/
Installing the NVIDIA driver, CUDA and cuDNN on Linux

Installing the NVIDIA driver, CUDA and cuDNN on Linux (Ubuntu 20.04)

This is a companion piece to my instructions on building TensorFlow from source. In particular, the aim is to install the following pieces of software

on an Ubuntu Linux system, in particular Ubuntu 20.04.

mohapatras /
Created October 15, 2021 03:30 — forked from Jongbhin/
[Cuda cudnn version check] #cuda #cudnn #nvidia

To check nvidia driver

modinfo nvidia

To check cuda version

cat /usr/local/cuda/version.txt
View gist:ea36f377f48cbbddfa4a7c685fa27218
$ ls -l /usr/local/cuda-10.1/lib64/libcurand*
lrwxrwxrwx 1 root root 15 Aug 22 02:49 /usr/local/cuda-10.1/lib64/ ->
lrwxrwxrwx 1 root root 21 Aug 22 02:49 /usr/local/cuda-10.1/lib64/ ->
-rwxr-xr-x 1 root root 59812280 Aug 22 02:49 /usr/local/cuda-10.1/lib64/
-rw-r--r-- 1 root root 59842274 Aug 22 02:49 /usr/local/cuda-10.1/lib64/libcurand_static.a
mohapatras / repo_push_github
Created February 15, 2020 07:17
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 June 21, 2018 05:01
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 April 4, 2018 13:56
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 June 15, 2022 15:14
# 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 March 23, 2018 05:45
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