Is there any difference between the convolution operation applied to images and applied to other numerical 2D data?

4

Is there any difference between the convolution operation applied to images and applied to other numerical 2D data?

For example, we have a pretty good CNN model trained on a number of $64 \times 64$ images to detect two classes. On the other hand, we have a number of $64 \times 64$ numerical 2D matrices (which are not considered images), which also have two classes. Can we use the same CNN model to classify the numerical dataset?

Jarin Tasnim

Posted 2020-03-04T20:17:57.710

Reputation: 43

Images and numerical 2D data are the same thing. Having that, a CNNs viability depends on if the input data has a reasonable number and density of 2D features. If row 1 of your input data has no relation to row 2, a CNN is not a good choice. – Recessive – 2020-03-05T02:41:12.453

Of course, you can do it, but here's a new problem - how to interpret the results of the predictions? – Leox – 2020-03-05T16:46:15.477

There should be spatial correlation between neighboring elements. If in your matrix neighboring elements are (almost) independent 2D convolution is useless. – mirror2image – 2020-03-12T06:18:40.940

Answers

1

To offer a bit of theory, CNNs work well for many image tasks because they process spacially local information, without much care for absolute position. Essentially, every layer chops every image up into tiny crop images, and do an analysis step on the crops. The simple questions of "is this a line... corner... eye... face?" can be asked equally of every crop.

This means that the network only needs to learn once to detect a feature, rather than separately learn to detect that feature in each possible location it might appear. Therefore we can use smaller networks that train faster and need less data than if we had a fully connected architecture.

To return to the question, you could expect a CNN to work if your data is similarly spacially correlated. Put another way, if finding a pattern around cell x, y means the same sort of thing as the same pattern in cell a, b, then you are probably in luck. On the other hand if each column represents a meaningfully different concept, then a CNN will be a poor choice of architecture.

Josiah

Posted 2020-03-04T20:17:57.710

Reputation: 211

2

Short answer is no. You can't use a model trained for one task to predict on a totally different task. Even if the second task was another image classification task, the CNN would have to be fine tuned for the new data to work.

A couple of things to note...

1) CNNs are good for images due to their nature. It isn't necessary that they'd be good for any 2-dimensional input.

2) By 2D numerical data I'm assuming you don't mean tabular data.

Djib2011

Posted 2020-03-04T20:17:57.710

Reputation: 2 624

Thanks for your answer. By 2D numerical data, I meant geospatial data in tabular form. I was wondering if can take advantage of CNN models for those geospatial data. but you are right, same model working good for images wont work on matrices because of the variation – Jarin Tasnim – 2020-03-05T18:17:38.493