Revert "Merge branch 'oneclick_nn_training' into 'master'"

This reverts merge request !29
parent 3cde5fb4
Pipeline #106956 passed with stages
in 4 minutes and 28 seconds
......@@ -8,15 +8,15 @@
<groupId>de.monticore.lang.monticar</groupId>
<artifactId>cnnarch-caffe2-generator</artifactId>
<version>0.2.8</version>
<version>0.2.8-SNAPSHOT</version>
<!-- == PROJECT DEPENDENCIES ============================================= -->
<properties>
<!-- .. SE-Libraries .................................................. -->
<CNNArch.version>0.2.8</CNNArch.version>
<CNNTrain.version>0.2.6</CNNTrain.version>
<CNNArch.version>0.2.7</CNNArch.version>
<CNNTrain.version>0.2.6-SNAPSHOT</CNNTrain.version>
<embedded-montiarc-math-generator>0.1.2-SNAPSHOT</embedded-montiarc-math-generator>
<!-- .. Libraries .................................................. -->
......
......@@ -28,7 +28,6 @@ import de.monticore.lang.monticar.cnnarch._symboltable.ArchitectureElementSymbol
import de.monticore.lang.monticar.cnnarch._symboltable.CompositeElementSymbol;
import de.monticore.lang.monticar.cnnarch._symboltable.CNNArchCompilationUnitSymbol;
import de.monticore.lang.monticar.cnnarch._symboltable.CNNArchLanguage;
import de.monticore.lang.monticar.cnnarch.DataPathConfigParser;
import de.monticore.lang.monticar.generator.FileContent;
import de.monticore.lang.monticar.generator.cmake.CMakeConfig;
import de.monticore.lang.monticar.generator.cmake.CMakeFindModule;
......@@ -47,7 +46,6 @@ import java.util.List;
public class CNNArch2Caffe2 implements CNNArchGenerator{
private String generationTargetPath;
private String modelPath;
private boolean isSupportedLayer(ArchitectureElementSymbol element, LayerSupportChecker layerChecker){
List<ArchitectureElementSymbol> constructLayerElemList;
......@@ -78,14 +76,6 @@ public class CNNArch2Caffe2 implements CNNArchGenerator{
return true;
}
public String getModelPath(){
return modelPath;
}
public void setModelPath(Path modelPath){
this.modelPath = modelPath.toString();
}
private static void quitGeneration(){
Log.error("Code generation is aborted");
System.exit(1);
......@@ -114,7 +104,6 @@ public class CNNArch2Caffe2 implements CNNArchGenerator{
public void generate(Path modelsDirPath, String rootModelName){
final ModelPath mp = new ModelPath(modelsDirPath);
GlobalScope scope = new GlobalScope(mp, new CNNArchLanguage());
setModelPath(modelsDirPath);
generate(scope, rootModelName);
}
......@@ -131,11 +120,6 @@ public class CNNArch2Caffe2 implements CNNArchGenerator{
}
try{
String confPath = getModelPath() + "/data_paths.txt";
DataPathConfigParser newParserConfig = new DataPathConfigParser(confPath);
String dataPath = newParserConfig.getDataPath(rootModelName);
compilationUnit.get().getArchitecture().setDataPath(dataPath);
compilationUnit.get().getArchitecture().setComponentName(rootModelName);
generateFiles(compilationUnit.get().getArchitecture());
} catch (IOException e){
Log.error(e.toString());
......
......@@ -89,11 +89,6 @@ public class CNNArchTemplateController {
return getArchitecture().getEnclosingScope().getSpanningSymbol().get().getFullName().replaceAll("\\.","_");
}
public String getDataPath(){
return getArchitecture().getDataPath();
}
public List<String> getLayerInputs(ArchitectureElementSymbol layer){
List<String> inputNames = new ArrayList<>();
......@@ -130,10 +125,6 @@ public class CNNArchTemplateController {
return list;
}
public String getComponentName(){
return getArchitecture().getComponentName();
}
public String getArchitectureLoss(){
return this.loss;
}
......
......@@ -13,8 +13,8 @@ class ${tc.fileNameWithoutEnding}:
module = None
_current_dir_ = os.path.join('./')
_data_dir_ = os.path.join(_current_dir_, '${tc.dataPath}')
_model_dir_ = os.path.join(_current_dir_, 'model', '${tc.componentName}')
_data_dir_ = os.path.join(_current_dir_, 'data', '${tc.fullArchitectureName}')
_model_dir_ = os.path.join(_current_dir_, 'model', '${tc.fullArchitectureName}')
_init_net_ = os.path.join(_model_dir_, 'init_net.pb')
_predict_net_ = os.path.join(_model_dir_, 'predict_net.pb')
......
......@@ -18,8 +18,8 @@
#include <iostream>
#include <map>
CAFFE2_DEFINE_string(init_net_${tc.fileNameWithoutEnding}, "./model/${tc.componentName}/init_net.pb", "The given path to the init protobuffer.");
CAFFE2_DEFINE_string(predict_net_${tc.fileNameWithoutEnding}, "./model/${tc.componentName}/predict_net.pb", "The given path to the predict protobuffer.");
CAFFE2_DEFINE_string(init_net, "./model/${tc.fullArchitectureName}/init_net.pb", "The given path to the init protobuffer.");
CAFFE2_DEFINE_string(predict_net, "./model/${tc.fullArchitectureName}/predict_net.pb", "The given path to the predict protobuffer.");
using namespace caffe2;
......@@ -43,21 +43,21 @@ class ${tc.fileNameWithoutEnding}{
char **a[1];
caffe2::GlobalInit(&n, a);
if (!std::ifstream(FLAGS_init_net_${tc.fileNameWithoutEnding}).good()) {
std::cerr << "\nNetwork loading failure, init_net file '" << FLAGS_init_net_${tc.fileNameWithoutEnding} << "' does not exist." << std::endl;
if (!std::ifstream(FLAGS_init_net).good()) {
std::cerr << "\nNetwork loading failure, init_net file '" << FLAGS_init_net << "' does not exist." << std::endl;
exit(1);
}
if (!std::ifstream(FLAGS_predict_net_${tc.fileNameWithoutEnding}).good()) {
std::cerr << "\nNetwork loading failure, predict_net file '" << FLAGS_predict_net_${tc.fileNameWithoutEnding} << "' does not exist." << std::endl;
if (!std::ifstream(FLAGS_predict_net).good()) {
std::cerr << "\nNetwork loading failure, predict_net file '" << FLAGS_predict_net << "' does not exist." << std::endl;
exit(1);
}
std::cout << "\nLoading network..." << std::endl;
// Read protobuf
CAFFE_ENFORCE(ReadProtoFromFile(FLAGS_init_net_${tc.fileNameWithoutEnding}, &initNet));
CAFFE_ENFORCE(ReadProtoFromFile(FLAGS_predict_net_${tc.fileNameWithoutEnding}, &predictNet));
CAFFE_ENFORCE(ReadProtoFromFile(FLAGS_init_net, &initNet));
CAFFE_ENFORCE(ReadProtoFromFile(FLAGS_predict_net, &predictNet));
// Set device type
#ifdef USE_GPU
......
Alexnet data/Alexnet
CifarClassifierNetwork data/CifarClassifierNetwork
LeNet data/LeNet
VGG16 data/VGG16
MultipleOutputs data/MultipleOutputs
\ No newline at end of file
Alexnet data/Alexnet
CifarClassifierNetwork data/CifarClassifierNetwork
LeNet data/LeNet
VGG16 data/VGG16
MultipleOutputs data/MultipleOutputs
\ No newline at end of file
......@@ -12,7 +12,7 @@ class CNNCreator_Alexnet:
module = None
_current_dir_ = os.path.join('./')
_data_dir_ = os.path.join(_current_dir_, 'data/Alexnet')
_data_dir_ = os.path.join(_current_dir_, 'data', 'Alexnet')
_model_dir_ = os.path.join(_current_dir_, 'model', 'Alexnet')
_init_net_ = os.path.join(_model_dir_, 'init_net.pb')
......
......@@ -12,7 +12,7 @@ class CNNCreator_CifarClassifierNetwork:
module = None
_current_dir_ = os.path.join('./')
_data_dir_ = os.path.join(_current_dir_, 'data/CifarClassifierNetwork')
_data_dir_ = os.path.join(_current_dir_, 'data', 'CifarClassifierNetwork')
_model_dir_ = os.path.join(_current_dir_, 'model', 'CifarClassifierNetwork')
_init_net_ = os.path.join(_model_dir_, 'init_net.pb')
......
......@@ -13,7 +13,7 @@ class CNNCreator_LeNet:
module = None
_current_dir_ = os.path.join('./')
_data_dir_ = os.path.join(_current_dir_, 'data/LeNet')
_data_dir_ = os.path.join(_current_dir_, 'data', 'LeNet')
_model_dir_ = os.path.join(_current_dir_, 'model', 'LeNet')
_init_net_ = os.path.join(_model_dir_, 'init_net.pb')
......
......@@ -13,7 +13,7 @@ class CNNCreator_VGG16:
module = None
_current_dir_ = os.path.join('./')
_data_dir_ = os.path.join(_current_dir_, 'data/VGG16')
_data_dir_ = os.path.join(_current_dir_, 'data', 'VGG16')
_model_dir_ = os.path.join(_current_dir_, 'model', 'VGG16')
_init_net_ = os.path.join(_model_dir_, 'init_net.pb')
......
......@@ -18,8 +18,8 @@
#include <iostream>
#include <map>
CAFFE2_DEFINE_string(init_net_CNNPredictor_LeNet, "./model/LeNet/init_net.pb", "The given path to the init protobuffer.");
CAFFE2_DEFINE_string(predict_net_CNNPredictor_LeNet, "./model/LeNet/predict_net.pb", "The given path to the predict protobuffer.");
CAFFE2_DEFINE_string(init_net, "./model/LeNet/init_net.pb", "The given path to the init protobuffer.");
CAFFE2_DEFINE_string(predict_net, "./model/LeNet/predict_net.pb", "The given path to the predict protobuffer.");
using namespace caffe2;
......@@ -43,21 +43,21 @@ class CNNPredictor_LeNet{
char **a[1];
caffe2::GlobalInit(&n, a);
if (!std::ifstream(FLAGS_init_net_CNNPredictor_LeNet).good()) {
std::cerr << "\nNetwork loading failure, init_net file '" << FLAGS_init_net_CNNPredictor_LeNet << "' does not exist." << std::endl;
if (!std::ifstream(FLAGS_init_net).good()) {
std::cerr << "\nNetwork loading failure, init_net file '" << FLAGS_init_net << "' does not exist." << std::endl;
exit(1);
}
if (!std::ifstream(FLAGS_predict_net_CNNPredictor_LeNet).good()) {
std::cerr << "\nNetwork loading failure, predict_net file '" << FLAGS_predict_net_CNNPredictor_LeNet << "' does not exist." << std::endl;
if (!std::ifstream(FLAGS_predict_net).good()) {
std::cerr << "\nNetwork loading failure, predict_net file '" << FLAGS_predict_net << "' does not exist." << std::endl;
exit(1);
}
std::cout << "\nLoading network..." << std::endl;
// Read protobuf
CAFFE_ENFORCE(ReadProtoFromFile(FLAGS_init_net_CNNPredictor_LeNet, &initNet));
CAFFE_ENFORCE(ReadProtoFromFile(FLAGS_predict_net_CNNPredictor_LeNet, &predictNet));
CAFFE_ENFORCE(ReadProtoFromFile(FLAGS_init_net, &initNet));
CAFFE_ENFORCE(ReadProtoFromFile(FLAGS_predict_net, &predictNet));
// Set device type
#ifdef USE_GPU
......
......@@ -18,8 +18,8 @@
#include <iostream>
#include <map>
CAFFE2_DEFINE_string(init_net_CNNPredictor_VGG16, "./model/VGG16/init_net.pb", "The given path to the init protobuffer.");
CAFFE2_DEFINE_string(predict_net_CNNPredictor_VGG16, "./model/VGG16/predict_net.pb", "The given path to the predict protobuffer.");
CAFFE2_DEFINE_string(init_net, "./model/VGG16/init_net.pb", "The given path to the init protobuffer.");
CAFFE2_DEFINE_string(predict_net, "./model/VGG16/predict_net.pb", "The given path to the predict protobuffer.");
using namespace caffe2;
......@@ -43,21 +43,21 @@ class CNNPredictor_VGG16{
char **a[1];
caffe2::GlobalInit(&n, a);
if (!std::ifstream(FLAGS_init_net_CNNPredictor_VGG16).good()) {
std::cerr << "\nNetwork loading failure, init_net file '" << FLAGS_init_net_CNNPredictor_VGG16 << "' does not exist." << std::endl;
if (!std::ifstream(FLAGS_init_net).good()) {
std::cerr << "\nNetwork loading failure, init_net file '" << FLAGS_init_net << "' does not exist." << std::endl;
exit(1);
}
if (!std::ifstream(FLAGS_predict_net_CNNPredictor_VGG16).good()) {
std::cerr << "\nNetwork loading failure, predict_net file '" << FLAGS_predict_net_CNNPredictor_VGG16 << "' does not exist." << std::endl;
if (!std::ifstream(FLAGS_predict_net).good()) {
std::cerr << "\nNetwork loading failure, predict_net file '" << FLAGS_predict_net << "' does not exist." << std::endl;
exit(1);
}
std::cout << "\nLoading network..." << std::endl;
// Read protobuf
CAFFE_ENFORCE(ReadProtoFromFile(FLAGS_init_net_CNNPredictor_VGG16, &initNet));
CAFFE_ENFORCE(ReadProtoFromFile(FLAGS_predict_net_CNNPredictor_VGG16, &predictNet));
CAFFE_ENFORCE(ReadProtoFromFile(FLAGS_init_net, &initNet));
CAFFE_ENFORCE(ReadProtoFromFile(FLAGS_predict_net, &predictNet));
// Set device type
#ifdef USE_GPU
......
Alexnet data/Alexnet
CifarClassifierNetwork data/CifarClassifierNetwork
LeNet data/LeNet
VGG16 data/VGG16
MultipleOutputs data/MultipleOutputs
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment