initial commit

Esse commit está contido em:
Brian Broll
2016-03-10 04:19:37 -06:00
commit 564edf20ff
17 arquivos alterados com 509 adições e 0 exclusões
+31
Ver Arquivo
@@ -0,0 +1,31 @@
*.swp
*.swo
# Logs
logs
*.log
# Runtime data
pids
*.pid
*.seed
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# node-waf configuration
.lock-wscript
# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release
# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
node_modules
tmp/
blob-local-storage/
+19
Ver Arquivo
@@ -0,0 +1,19 @@
# DeepForge
DeepForge is an open-source visual development environment for deep learning. Currently, it supports Convolutional Neural Networks but we are planning on supporting additional deep learning classifiers such as RNNs and LSTMs. Additional features include real-time collaborative editing and version control.
## Quick Setup
After cloning the repo, run
```
npm install && npm start
```
Now, navigate to `localhost:8080` in a browser and create a new project. Select `Caffe` as the seed and start creating your neural nets!
There are examples in the `Examples` directory.
## Caffe Support?
DeepForge uses Torch to perform the actual training and testing of the models. If you are interested in DeepForge using Caffe for actual training and testing, check out [DeepForge-Caffe](https://github.com/dfst/deepforge-caffe).
## Interested in contributing?
Contributions are welcome! Either fork the project and submit some PR's or shoot me an email about getting more involved!
+13
Ver Arquivo
@@ -0,0 +1,13 @@
// jshint node: true
'use strict';
var gmeConfig = require('./config'),
webgme = require('webgme'),
myServer;
webgme.addToRequireJsPaths(gmeConfig);
myServer = new webgme.standaloneServer(gmeConfig);
myServer.start(function () {
//console.log('server up');
});
+7
Ver Arquivo
@@ -0,0 +1,7 @@
# Configuration
Overwrite/append the [default webgme configuration](https://github.com/webgme/webgme/blob/master/config/config.default.js) in `config.default.js`.
When adding your own paths, make sure to either use `__dirname` or a relative path which will be resolved from your repository's root.
To load another configuration set the environment variable `NODE_ENV` to the wanted configuration, e.g. on windows `set NODE_ENV = app` will load `config.app.js`.
+11
Ver Arquivo
@@ -0,0 +1,11 @@
'use strict';
var config = require('./config.webgme'),
validateConfig = require('webgme/config/validator');
// Add/overwrite any additional settings here
// config.server.port = 8080;
// config.mongo.uri = 'mongodb://127.0.0.1:27017/webgme_my_app';
validateConfig(config);
module.exports = config;
+13
Ver Arquivo
@@ -0,0 +1,13 @@
/*jshint node: true*/
/**
* @author lattmann / https://github.com/lattmann
*/
'use strict';
var config = require('./config.default');
config.server.port = 9001;
config.mongo.uri = 'mongodb://127.0.0.1:27017/webgme_tests';
module.exports = config;
+22
Ver Arquivo
@@ -0,0 +1,22 @@
// DO NOT EDIT THIS FILE
// This file is automatically generated from the webgme-setup-tool.
'use strict';
var config = require('webgme/config/config.default'),
validateConfig = require('webgme/config/validator');
// The paths can be loaded from the webgme-setup.json
config.plugin.basePaths.push('src/plugins');
// Visualizer descriptors
// Add requirejs paths
config.mongo.uri = 'mongodb://127.0.0.1:27017/deepforge';
validateConfig(config);
module.exports = config;
+15
Ver Arquivo
@@ -0,0 +1,15 @@
/*jshint node: true*/
/**
* @author lattmann / https://github.com/lattmann
* @author pmeijer / https://github.com/pmeijer
*/
'use strict';
var env = process.env.NODE_ENV || 'default',
configFilename = __dirname + '/config.' + env + '.js',
config = require(configFilename),
validateConfig = require('webgme/config/validator');
validateConfig(configFilename);
module.exports = config;
+16
Ver Arquivo
@@ -0,0 +1,16 @@
{
"name": "deepforge",
"scripts": {
"start": "node app.js",
"test": "node ./node_modules/mocha/bin/mocha --recursive test"
},
"version": "1.0.0",
"dependencies": {
"webgme": "^1.1.0"
},
"devDependencies": {
"mocha": "^2.2.5",
"rimraf": "^2.4.0",
"chai": "^3.0.0"
}
}
+168
Ver Arquivo
@@ -0,0 +1,168 @@
/*globals define*/
/*jshint node:true, browser:true*/
/**
* Generated by PluginGenerator 0.14.0 from webgme on Thu Mar 10 2016 04:16:02 GMT-0600 (CST).
*/
define([
'plugin/PluginConfig',
'plugin/PluginBase'
], function (
PluginConfig,
PluginBase) {
'use strict';
/**
* Initializes a new instance of ImportTorch.
* @class
* @augments {PluginBase}
* @classdesc This class represents the plugin ImportTorch.
* @constructor
*/
var ImportTorch = function () {
// Call base class' constructor.
PluginBase.call(this);
};
// Prototypal inheritance from PluginBase.
ImportTorch.prototype = Object.create(PluginBase.prototype);
ImportTorch.prototype.constructor = ImportTorch;
/**
* Gets the name of the ImportTorch.
* @returns {string} The name of the plugin.
* @public
*/
ImportTorch.prototype.getName = function () {
return 'ImportTorch';
};
/**
* Gets the semantic version (semver.org) of the ImportTorch.
* @returns {string} The version of the plugin.
* @public
*/
ImportTorch.prototype.getVersion = function () {
return '0.1.0';
};
/**
* Gets the configuration structure for the ImportTorch.
* The ConfigurationStructure defines the configuration for the plugin
* and will be used to populate the GUI when invoking the plugin from webGME.
* @returns {object} The version of the plugin.
* @public
*/
ImportTorch.prototype.getConfigStructure = function () {
return [
{
name: 'species',
displayName: 'Animal Species',
regex: '^[a-zA-Z]+$',
regexMessage: 'Name can only contain English characters!',
description: 'Which species does the animal belong to.',
value: 'Horse',
valueType: 'string',
readOnly: false
},
{
name: 'age',
displayName: 'Age',
description: 'How old is the animal.',
value: 3,
valueType: 'number',
minValue: 0,
maxValue: 10000,
readOnly: false
},
{
name: 'carnivore',
displayName: 'Carnivore',
description: 'Does the animal eat other animals?',
value: false,
valueType: 'boolean',
readOnly: false
},
{
name: 'classification',
displayName: 'Classification',
description: '',
value: 'Vertebrates',
valueType: 'string',
valueItems: [
'Vertebrates',
'Invertebrates',
'Unknown'
]
},
{
name: 'color',
displayName: 'Color',
description: 'The hex color code for the animal.',
readOnly: false,
value: '#FF0000',
regex: '^#([A-Fa-f0-9]{6})$',
valueType: 'string'
},
{
name: 'anAsset',
displayName: 'Document',
description: '',
value: '',
valueType: 'asset',
readOnly: false
}
];
};
/**
* Main function for the plugin to execute. This will perform the execution.
* Notes:
* - Always log with the provided logger.[error,warning,info,debug].
* - Do NOT put any user interaction logic UI, etc. inside this method.
* - callback always has to be called even if error happened.
*
* @param {function(string, plugin.PluginResult)} callback - the result callback
*/
ImportTorch.prototype.main = function (callback) {
// Use self to access core, project, result, logger etc from PluginBase.
// These are all instantiated at this point.
var self = this,
nodeObject;
// Using the logger.
self.logger.debug('This is a debug message.');
self.logger.info('This is an info message.');
self.logger.warn('This is a warning message.');
self.logger.error('This is an error message.');
// Using the coreAPI to make changes.
nodeObject = self.activeNode;
self.core.setAttribute(nodeObject, 'name', 'My new obj');
self.core.setRegistry(nodeObject, 'position', {x: 70, y: 70});
// Obtain the current user configuration.
var currentConfig = self.getCurrentConfig();
self.logger.info('Current configuration ' + JSON.stringify(currentConfig, null, 4));
// This will save the changes. If you don't want to save;
// exclude self.save and call callback directly from this scope.
self.save('ImportTorch updated model.', function (err) {
if (err) {
callback(err, self.result);
return;
}
self.result.setSuccess(true);
callback(null, self.result);
});
};
return ImportTorch;
});
+32
Ver Arquivo
@@ -0,0 +1,32 @@
// This is used by the test/plugins tests
/*globals requireJS*/
/*jshint node:true*/
/**
* @author pmeijer / https://github.com/pmeijer
*/
'use strict';
var testFixture = require('webgme/test/_globals'),
WEBGME_CONFIG_PATH = '../config';
// This flag will make sure the config.test.js is being used
// process.env.NODE_ENV = 'test'; // This is set by the require above, overwrite it here.
var WebGME = testFixture.WebGME,
gmeConfig = require(WEBGME_CONFIG_PATH),
getGmeConfig = function getGmeConfig() {
'use strict';
// makes sure that for each request it returns with a unique object and tests will not interfere
if (!gmeConfig) {
// if some tests are deleting or unloading the config
gmeConfig = require(WEBGME_CONFIG_PATH);
}
return JSON.parse(JSON.stringify(gmeConfig));
};
WebGME.addToRequireJsPaths(gmeConfig);
testFixture.getGmeConfig = getGmeConfig;
module.exports = testFixture;
+79
Ver Arquivo
@@ -0,0 +1,79 @@
/*jshint node:true, mocha:true*/
/**
* Generated by PluginGenerator 0.14.0 from webgme on Thu Mar 10 2016 04:16:02 GMT-0600 (CST).
*/
'use strict';
var testFixture = require('../../globals');
describe('ImportTorch', function () {
var gmeConfig = testFixture.getGmeConfig(),
expect = testFixture.expect,
logger = testFixture.logger.fork('NewPlugin'),
PluginCliManager = testFixture.WebGME.PluginCliManager,
projectName = 'testProject',
pluginName = 'ImportTorch',
project,
gmeAuth,
storage,
commitHash;
before(function (done) {
testFixture.clearDBAndGetGMEAuth(gmeConfig, projectName)
.then(function (gmeAuth_) {
gmeAuth = gmeAuth_;
// This uses in memory storage. Use testFixture.getMongoStorage to persist test to database.
storage = testFixture.getMemoryStorage(logger, gmeConfig, gmeAuth);
return storage.openDatabase();
})
.then(function () {
var importParam = {
projectSeed: testFixture.path.join(testFixture.SEED_DIR, 'EmptyProject.json'),
projectName: projectName,
branchName: 'master',
logger: logger,
gmeConfig: gmeConfig
};
return testFixture.importProject(storage, importParam);
})
.then(function (importResult) {
project = importResult.project;
commitHash = importResult.commitHash;
return project.createBranch('test', commitHash);
})
.nodeify(done);
});
after(function (done) {
storage.closeDatabase()
.then(function () {
return gmeAuth.unload();
})
.nodeify(done);
});
it('should run plugin and update the branch', function (done) {
var manager = new PluginCliManager(null, logger, gmeConfig),
pluginConfig = {
},
context = {
project: project,
commitHash: commitHash,
branchName: 'test',
activeNode: '/960660211',
};
manager.executePlugin(pluginName, pluginConfig, context, function (err, pluginResult) {
expect(err).to.equal(null);
expect(typeof pluginResult).to.equal('object');
expect(pluginResult.success).to.equal(true);
project.getBranchHash('test')
.then(function (branchHash) {
expect(branchHash).to.not.equal(commitHash);
})
.nodeify(done);
});
});
});
@@ -0,0 +1,5 @@
require 'nn'
model = nn.Sequential()
model:add(nn.Reshape(ninputs))
model:add(nn.Linear(ninputs,noutputs))
@@ -0,0 +1,13 @@
require 'nn'
-- dummy values
local ninputs = 100
local nhiddens = 300
local noutputs = 10
-- Simple 2-layer neural network, with tanh hidden units
model = nn.Sequential()
model:add(nn.Reshape(ninputs))
model:add(nn.Linear(ninputs,nhiddens))
model:add(nn.Tanh())
model:add(nn.Linear(nhiddens,noutputs))
@@ -0,0 +1,30 @@
require 'nn'
-- a typical convolutional network, with locally-normalized hidden
-- units, and L2-pooling
-- Note: the architecture of this convnet is loosely based on Pierre Sermanet's
-- work on this dataset (http://arxiv.org/abs/1204.3968). In particular
-- the use of LP-pooling (with P=2) has a very positive impact on
-- generalization. Normalization is not done exactly as proposed in
-- the paper, and low-level (first layer) features are not fed to
-- the classifier.
model = nn.Sequential()
-- stage 1 : filter bank -> squashing -> L2 pooling -> normalization
model:add(nn.SpatialConvolutionMM(nfeats, nstates[1], filtsize, filtsize))
model:add(nn.Tanh())
model:add(nn.SpatialLPPooling(nstates[1],2,poolsize,poolsize,poolsize,poolsize))
model:add(nn.SpatialSubtractiveNormalization(nstates[1], normkernel))
-- stage 2 : filter bank -> squashing -> L2 pooling -> normalization
model:add(nn.SpatialConvolutionMM(nstates[1], nstates[2], filtsize, filtsize))
model:add(nn.Tanh())
model:add(nn.SpatialLPPooling(nstates[2],2,poolsize,poolsize,poolsize,poolsize))
model:add(nn.SpatialSubtractiveNormalization(nstates[2], normkernel))
-- stage 3 : standard 2-layer neural network
model:add(nn.Reshape(nstates[2]*filtsize*filtsize))
model:add(nn.Linear(nstates[2]*filtsize*filtsize, nstates[3]))
model:add(nn.Tanh())
model:add(nn.Linear(nstates[3], noutputs))
@@ -0,0 +1,22 @@
require 'nn'
-- a typical modern convolution network (conv+relu+pool)
model = nn.Sequential()
-- stage 1 : filter bank -> squashing -> L2 pooling -> normalization
model:add(nn.SpatialConvolutionMM(nfeats, nstates[1], filtsize, filtsize))
model:add(nn.ReLU())
model:add(nn.SpatialMaxPooling(poolsize,poolsize,poolsize,poolsize))
-- stage 2 : filter bank -> squashing -> L2 pooling -> normalization
model:add(nn.SpatialConvolutionMM(nstates[1], nstates[2], filtsize, filtsize))
model:add(nn.ReLU())
model:add(nn.SpatialMaxPooling(poolsize,poolsize,poolsize,poolsize))
-- stage 3 : standard 2-layer neural network
model:add(nn.View(nstates[2]*filtsize*filtsize))
model:add(nn.Dropout(0.5))
model:add(nn.Linear(nstates[2]*filtsize*filtsize, nstates[3]))
model:add(nn.ReLU())
model:add(nn.Linear(nstates[3], noutputs))
+13
Ver Arquivo
@@ -0,0 +1,13 @@
{
"components": {
"plugins": {
"ImportTorch": {
"src": "src/plugins/ImportTorch",
"test": "test/plugins/ImportTorch"
}
}
},
"dependencies": {
"plugins": {}
}
}