Dear ml5 community,
I'm submitting a new issue. Please see the details below.
I was trying to create neural network with multiple layers in ml5, but it did not work, and gave me error. I changed it to default layers. i.e. did not pass "layers" in the option and it worked. I checked the ml5 source code for neural network and noticed that the condition for passing the layers is not correct. Here's the source code snippet:
// check to see if layers are passed into the constructor
// then use those to create your architecture
if (!this.neuralNetwork.isLayered) {
this.options.layers = this.createNetworkLayers(
this.options.layers,
this.neuralNetworkData.meta,
);
}
// if the model does not have any layers defined yet
// then use the default structure
if (!this.neuralNetwork.isLayered) {
this.options.layers = this.addDefaultLayers(this.options.task, this.neuralNetworkData.meta);
}
I think the bolded text should be without "not !", since the condition is the same for both "if" statements.
Thanks,
M
Hi @sci2lab - I think this may be resolved in the upcoming release of the refactored neural network. Thanks for reporting this! Let's keep this open until we make our new release (maybe by sometime today)
Hi @joeyklee - is this still going to be fixed? (In the development branch, the problem is still there as you can see here). Would it be helpful for me to open a PR for it?
Hi @EmmaGoodliffe - Thanks for all the work you've been doing! It has been great to see you contributions answering issues and making PRs. Apologies for the slow responses - I've had to fix my computer and it has taken longer than anticipated.
Happy to receive feedback on this also if there's a more clear and readable way to handle checking if the layers have been defined! π
@joeyklee No problem π!
You're right that it is definitely working. My bad! Should this be closed then?
P.S. I hope you fix your computer π
@EmmaGoodliffe - Thanks so much for checking. No problem. Your help has been so amazing.
I will close this one up for now! This reminds me we should add additional documentation on how to handle custom layers!