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:
- Pydub (pydub.com)
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 |
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 |
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: