Storing a plot into a bumpy array such that it can be used for pattern recognition...

I seem to have some problems storing a plot created using matplotlib.pcolormesh(). As far i know is pcolormesh convert an input data matrix given a colormap, and the colormap gives a RGB values for each entries in matrix and plots it. Which in my head would be similar to import numpy as np import matplotlib.pyplot as plt import matplotlib from PIL import Image import librosa import librosa.display from matplotlib import cm fig = plt.figure(figsize=(12,4)) min = -1.828067 max = 22.70058 data = np.random.uniform(low=min, high=max, size=(474,40)) librosa.display.specshow(data.T,sr=16000,x_axis='frames',y_axis='mel',hop_length=160,cmap=cm.jet) plt.axis('off') plt.show() raw_input("sadas") convert = plt.get_cmap(cm.jet) norm = matplotlib.colors.Normalize(vmin=0,vmax=1) numpy_output_static = convert(norm(data.T)) plt.imshow(numpy_output_static,cmap = cm.jet, aspect = 'auto') plt.show() raw_input("asds”) Problem here is I need to store as a numpy array, and the data has to represent the plot as the array is being used as an input for a NN, in which input matters, and won't be able learn anything if the input doesn't resemble or show the same patterns which the NN has to learn. So how do make it store the actual plot, and keep the dimensions of data that used to make the plot. You may notice I am using librosa to make the plot above. Librosa basically do a pcolormesh plot, in which the argument only set the x-axis and y-axis , and scale them to the proper size. here is the actual source code: https://github.com/librosa/librosa/blob/master/librosa/display.py#L459 <https://github.com/librosa/librosa/blob/master/librosa/display.py#L459> Here is the first image: Here is the second image:
participants (1)
-
Carlton Banks