Reputation: 543
Inspired by the blog post http://blog.avenuecode.com/using-deep-convolutional-neural-networks-dcnns-for-time-series-forecasting-using-tensorflow-part-1
where a time series of electricity consumption is converted into image representation for prediction, I was wondering of a simple example of using the same concept of predicting the next value of the time series to build a puzzle game. However, the time series is represented as an image. The point I don't understand is what should be the labels/predictor output? Take for example, in the following code the image A
is followed by B
since B
is generated from the next time instant after A
. The objective is that the model should be able to arrange the images in sequence to build a puzzle.
Question1) During training what should be the labels? I will have several such images. Then, during testing I will jumble the sequence and the model should give me the correct order aka prediction of the next image. Is that even possible?
Question2) I have represented the image as gray scale. Is there a better visualization colorful way that makes more sense in discriminating visually rather than just the salt and pepper visualization?
Shall be extremely grateful for suggestions
clear all
data=100*rand(3000,1);
x1= data(1:1024);
img1=reshape(x1,32,32);
img11=double(repmat(img1,[1 1 3]));
imwrite(uint8(img11), 'A.jpg');
x2= data(1025:2048);
img2=reshape(x2,32,32);
img22=double(repmat(img2,[1 1 3]));
imwrite(uint8(img22), 'B.jpg');
Upvotes: 1
Views: 173
Reputation: 181
Well, it doesn't really make a whole lot of sense to use images to represent time series data. What you really want is just the data point itself, not some visualization of the data point. There are neural networks designed to perform predictions from time-series analysis, and as far as I know none of them take images as input. What you really want is something called a Recurrent Neural Network (RNN). You may find Long Short-Term Memory (LSTM) networks to be of particular value in your use case.
If you are honestly and truly stuck with images, I am not experienced enough to tell you what might be the best approach. However there is research out there that appears to have done this. Here is an additional example.
- During training what should be the labels?
Well you would need some kind of encoding, your proposal of a an alphanumeric sequence should suffice; but it may be easier to use integers.
Then, during testing I will jumble the sequence and the model should give me the correct order aka prediction of the next image. Is that even possible?
Sure, why wouldn't this be possible? But there is a problem with testing in this way, it's called Information Leakage. You really want to provide the classifier with a new image it hasn't seen from the original time series, and then see if it can predict where it falls in the sequence of images that it has seen (been trained on).
I have represented the image as gray scale. Is there a better visualization colorful way that makes more sense in discriminating visually rather than just the salt and pepper visualization?
Looking at the tutorial you provided, the end result was a matrix of binary values (either a 0 or a 1). A black and white image is a natural choice to represent a matrix of zeros and ones. You took it one step further by going to greyscale and you are now using all 0 - 255
possible pixel intensity values achievable with the uint8
datatype. What else could you do visualization wise? Well a lot, but not in terms of representing just the data matrix alone. If you were hoping to get an RGB image, it is the same process as the greyscale image just repeat for 3 channels (Red, Green, and Blue). However, in your problem domain I don't really see how to do this easily. For instance, what constitutes the red channel? What about the green, or blue? This tells me that your current visualization technique is probably a good choice.
Upvotes: 1