Skip to content

Instantly share code, notes, and snippets.

View Ashindustry007's full-sized avatar
📕
Learning

Ashish Kumar Panda Ashindustry007

📕
Learning
View GitHub Profile
@patrickbrus
patrickbrus / CAM.py
Created July 28, 2020 06:29
Function for computing CAM
def get_class_activation_map(model, img):
'''
this function computes the class activation map
Inputs:
1) model (tensorflow model) : trained model
2) img (numpy array of shape (224, 224, 3)) : input image
'''
# expand dimension to fit the image to a network accepted input size
@adonese
adonese / quicksort.py
Created March 22, 2016 09:25
Quicksort 3-way partition algorithm
def partition3(A, l, r):
"""
partition3: A partition for quicksort algorithm. We'll use the 3-way to handle few equal elements in array (happens
a lot in practical use.)
This function is called from the main function quick_sort.
"""
lt = l # We initiate lt to be the part that is less than the pivot
i = l # We scan the array from left to right
gt = r # The part that is greater than the pivot
pivot = A[l] # The pivot, chosen to be the first element of the array, that why we'll randomize the first elements position
@jiaaro
jiaaro / Generate WAV from MIDI.md
Last active April 11, 2023 04:11
Generate a wave file from a MIDI file with Pydub

Simple example of rendering a midi file with Pydub

Basically, this takes a MIDI input file (I just googled and grabbed one of Maroon 5's "Animal" – I know, I know) and generates a WAV file.

NOTE: This is the slowest midi rendering program I have ever seen!

Dependencies: