Background
Hi all. I'm new to Machine Learning & Cross Validated, so please let me know if I made any mistakes. Any advice to point me in the right direction would be greatly appreciated.
Problem
I created a 2D Convolutional Neural Network Classification Model using this tutorial, and I used my own data.
I was very excited, until I saw the following problems:
- The loss is increasing (or stable) as the # epochs increases
- The browser becomes incredibly slow:
High memory usage in GPU: 1275.60 MB, most likely due to a memory leak
Attempted Solutions
To address Problem #1, I tried optimizing the hyperparameters, as recommended by Sycorax:
- Adjusted Learning Rate: decreased from 0.1 to 0.05 and increased from 0.01 to 0.05. Neither inc. or dec. it improved the loss function.
- Adjusted Batch Size: increased from 16 to 32 and decreased from 16 to 8. Neither inc. or dec. it improved the loss.
- Unit Testing: I isolated sections of the CNN and checked if they resulted in the expected output, which they did. For instance, I checked if I was retrieving the correct training data using
image(linearSinusoidal[0], 0, 0, width, height)
, which verified I was indeed importing the right classes for Supervised Learning.
I also checked normalization and other components of the CNN, but to no avail. What can I do to fixed this problem?
MWE
function setup() {
let options = {
inputs: [432, 288, 4],
task: 'imageClassification',
debug: true,
learningRate: 0.05,
hiddenUnits: 5,
};
functionClassifier = ml5.neuralNetwork(options);
for (let i = 0; i < linearSinusoidal.length; i++){
functionClassifier.addData({ image: linearSinusoidal[i] },{ label: "Linear Sinusoidal" });
functionClassifier.addData({ image: quadraticSinusoidal[i] },{ label: "Quadratic Sinusoidal" });
functionClassifier.addData({ image: cubicSinusoidal[i] },{ label: "Cubic Sinusoidal" });
}
functionClassifier.normalizeData();
functionClassifier.train({epochs: 50}, finishedTraining);
}