Let's say, for example, I have built the following CNN model using Keras:
model = Sequential() model.add(Conv2D(32, (3,3), activation='relu', input_shape=(32,32,3))) model.add(MaxPooling2D((2, 2))) model.add(Conv2D(32, (3,3), activation='relu')) model.add(MaxPooling2D((2, 2))) model.add(Flatten()) model.add(Dense(512)) model.add(Dense(10, activation='softmax'))
I wish to be able to transform the above model into a mathematical formula.
I understand the basic structure of a CNN as follows:
However, I do not know how to go from the above recursive formula to something like this (the first two summations are weights and the second two are adjustable biases):
Note: The formula above is just an example and not representative of the code given above.
- Do I need to trace each weight, each bias and each connection of every neuron? If so, how?
- Furthermore, I would highly appreciate it if someone could provide a generalized strategy for tackling such a problem (like finding a math formula to suit a different kind of classifier).
- Lastly, is this an easy task and is it a worthwhile one?
Note: This question was originally posted on Stack Overflow. Unfortunately, I received no responses even after offering a bounty. Hence, I am uploading the question here. Link to the original post here.