Over these past 3 days I was able to add a better prediction and training for my convolutional neural network.
- im2col: I switched from traditional sliding over the image, which was inefficient, to an algorithm that enhances it. It first extracts patches by sliding the filter across the input tensor, extracting every patch (they overlap too). Each patch is 3D, so it must be flattened into a vector and then stacked to form a 2D array. The weights are then also stacked to form a 2D array. Finally, the 2 matrices are multiplied.
- backpropagation: The CNN also needs to learn, so it accumulates gradients, which it uses to calculate how much the error changes by modifying weights and bias. The opposite of im2col is also used to calculate errors. However, in the beginning, the dense layers also need to pass their errors back, so I made a method that passes errors, specifically for CNN backpropagation.
- Pooling layers: pooling layers are very important for CNNs, as they reduce the size of the feature maps, which can help cut down computing costs. It can also help the model recognize an object, even if its position is shifted slightly.
- I might implement a GPU-accelerated CNN using tornadoVM, but this will be challenging, as I may have to modify methods. However, for larger-scale networks, this might add a large performance boost.
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.