[scikit-image] Storing a plot into a bumpy array such that it can be used for pattern recognition...
Carlton Banks
noflaco at gmail.com
Sat May 13 22:44:50 EDT 2017
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:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scikit-image/attachments/20170514/37b59c48/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bY0FU.png
Type: image/png
Size: 89483 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/scikit-image/attachments/20170514/37b59c48/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PKXx7.png
Type: image/png
Size: 33085 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/scikit-image/attachments/20170514/37b59c48/attachment-0003.png>
More information about the scikit-image
mailing list