- added StackCreator

git-svn-id: http://moon:8086/svn/software/trunk/projects/Rbm@823 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
2022-01-17 18:40:50 +00:00
parent 64ef87879f
commit e55f8e2153
12 changed files with 284 additions and 104 deletions
+11 -8
View File
@@ -24,6 +24,7 @@
#include <sys/types.h>
#include <pwd.h>
#include "MainComponent.hpp"
#include "StackCreator.hpp"
//[MiscUserDefs] You can add your own user definitions and misc code here...
@@ -47,6 +48,7 @@ MainComponent::MainComponent (const String prjname)
, m_weightIndex(0)
, m_toolTipWindow(this)
, m_file(prjname)
, m_dir(".")
{
addAndMakeVisible (trainButton = new TextButton ("Train button"));
trainButton->setTooltip (TRANS("Start/Stop training"));
@@ -557,7 +559,7 @@ void MainComponent::buttonClicked (Button* buttonThatWasClicked)
if (!m_stack)
{
m_stack = new DeepStack(m_file.getParentDirectory().getFullPathName().toStdString(), std::string(projectNameLabel->getText().getCharPointer()));
m_stack = new DeepStack(std::string(projectNameLabel->getText().getCharPointer()));
}
Layer *pPrev = m_stack->getLayer(next_index-1);
if (pPrev)
@@ -565,7 +567,7 @@ void MainComponent::buttonClicked (Button* buttonThatWasClicked)
numVisX = pPrev->bh().n_elem;
numVisY = 1;
}
m_stack->addLayer(onConstruct("Layer", next_index, numVisX, numVisY, numHid, numCtx));
m_stack->addLayer(onConstruct(m_stack, "Layer", next_index, numVisX, numVisY, numHid, numCtx));
m_rbmSelect->addItem(String(next_index), next_index+1);
m_rbmSelect->setSelectedId(next_index+1, sendNotification);
//[/UserButtonCode_createButton]
@@ -583,9 +585,10 @@ void MainComponent::buttonClicked (Button* buttonThatWasClicked)
{
m_file = fc->getResult();
projectNameLabel->setText(m_file.getFileNameWithoutExtension(), NotificationType::dontSendNotification);
m_stack = new DeepStack(m_file.getParentDirectory().getFullPathName().toStdString(), std::string(projectNameLabel->getText().getCharPointer()));
m_stack->load(this);
m_stack->loadWeights();
AStack *pStack = StackCreator::fromFile(m_file.getParentDirectory().getFullPathName().toStdString(), std::string(projectNameLabel->getText().getCharPointer()), this);
m_stack = reinterpret_cast<DeepStack*>(pStack);
// m_stack->load(this);
m_stack->loadWeights(m_dir);
m_rbmSelect->clear(dontSendNotification);
for (int id=0; id < m_stack->numLayers(); id++)
@@ -880,9 +883,9 @@ void MainComponent::mouseWheelMove (const MouseEvent& e, const MouseWheelDetails
//[MiscUserCode] You can add your own definitions of your custom methods or any other code here...
void MainComponent::save ()
{
m_stack->saveTrainingBatch();
m_stack->saveWeights();
m_stack->save();
m_stack->saveTrainingBatch(m_dir);
m_stack->saveWeights(m_dir);
m_stack->save(m_dir);
}
const juce::String& MainComponent::getBaseDir()