Commit 09278b79 authored by Hiroshi Hamano's avatar Hiroshi Hamano
Browse files

Create experiment directory with conf files for AutoML

parent aef4cd55
Pipeline #853933 failed with stage
in 12 minutes and 13 seconds
train.log
target/
.idea
model/
<?xml version="1.0" encoding="UTF-8"?>
<!-- (c) https://github.com/MontiCore/monticore -->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>de.monticore.lang.monticar.application</groupId>
<artifactId>mnist-calculator</artifactId>
<version>0.0.2-SNAPSHOT</version>
<properties>
<!-- .. Misc .......................................................... -->
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>mnist-calculator</artifactId>
<version>0.0.2-SNAPSHOT</version>
<classifier>training-weight</classifier>
<type>jar</type>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>${basedir}/src/main/resources</directory>
</resource>
<resource>
<directory>${project.build.directory}/generated-resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-shared-resources</id>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<phase>generate-resources</phase>
<configuration>
<outputDirectory>${project.build.directory}/generated-resources</outputDirectory>
<includeArtifacIds>mnist-calculator</includeArtifacIds>
<includeGroupIds>${project.groupId}</includeGroupIds>
<excludeTransitive>true</excludeTransitive>
<!--use as much as needed to be specific...also scope,type,classifier etc-->
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>de.monticore.lang.monticar.utilities</groupId>
<artifactId>maven-streamtest</artifactId>
<version>0.0.27-SNAPSHOT</version>
<configuration>
<pathMain>./src/main/ema/emadl/models</pathMain>
<pathTest>./src/main/ema/emadl/models</pathTest>
<pathTmpOut>./target/tmp</pathTmpOut>
<pathToPython>/usr/bin/python3</pathToPython>
<runStreamTestBefore>false</runStreamTestBefore>
<generator>MinGW</generator>
<backend>GLUON</backend>
<trainingNeeded>true</trainingNeeded>
<rootModel>cNNCalculator.Connector</rootModel>
</configuration>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>streamtest-build</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.5.4</version>
<configuration>
<descriptor>src/main/assembly/weight-assembly.xml</descriptor>
</configuration>
<executions>
<execution>
<id>training-data</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<finalName>${project.artifactId}-${project.version}</finalName>
<formats>
<format>jar</format>
</formats>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<distributionManagement>
<repository>
<id>se-nexus</id>
<url>https://nexus.se.rwth-aachen.de/content/repositories/embeddedmontiarc-releases/</url>
</repository>
<snapshotRepository>
<id>se-nexus</id>
<url>https://nexus.se.rwth-aachen.de/content/repositories/embeddedmontiarc-snapshots/</url>
</snapshotRepository>
</distributionManagement>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<!--
(c) https://github.com/MontiCore/monticore
-->
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<pluginGroups>
<pluginGroup>org.mortbay.jetty</pluginGroup>
<pluginGroup>de.topobyte</pluginGroup>
</pluginGroups>
<proxies>
</proxies>
<servers>
<server>
<id>se-nexus</id>
<username>cibuild</username>
<password>${env.cibuild}</password>
</server>
<server>
<id>github</id>
<username>travisbuilduser</username>
<password>${env.travisbuilduserpassword}</password>
</server>
<server>
<id>gitlab-maven</id>
<configuration>
<httpHeaders>
<property>
<name>Job-Token</name>
<value>${env.CI_JOB_TOKEN}</value>
</property>
</httpHeaders>
</configuration>
</server>
</servers>
<!--<mirrors>
<mirror>
<id>se-nexus</id>
<mirrorOf>external:*</mirrorOf>
<url>https://nexus.se.rwth-aachen.de/content/groups/public</url>
</mirror>
<mirror>
<id>topobyte-repository</id>
<mirrorOf>topobyte</mirrorOf>
<url>http://mvn.topobyte.de/</url>
</mirror>
<mirror>
<id>rosjava_mvn_repo</id>
<mirrorOf>rosjava_mvn</mirrorOf>
<url>https://github.com/rosjava/rosjava_mvn_repo/raw/master/</url>
</mirror>
</mirrors>-->
<profiles>
<profile>
<id>sonar</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<!-- Optional URL to server. Default value is http://localhost:9000 -->
<sonar.host.url>
https://metric.se.rwth-aachen.de
</sonar.host.url>
<sonar.login>
jenkins
</sonar.login>
<sonar.password>
${env.sonar}
</sonar.password>
</properties>
</profile>
<profile>
<id>se-nexus</id>
<repositories>
<repository>
<id>central</id>
<url>https://repo1.maven.org/maven2/</url>
<releases>
<enabled />
</releases>
<snapshots>
<enabled />
</snapshots>
</repository>
<repository>
<id>nexus</id>
<url>https://nexus.se.rwth-aachen.de/content/groups/public</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>gitlab-maven</id>
<url>https://git.rwth-aachen.de/api/v4/projects/57999/packages/maven</url>
<releases><enabled /></releases>
<snapshots><enabled /></snapshots>
</repository>
<repository>
<id>jena</id>
<url>https://bio.informatik.uni-jena.de/repository/libs-release-oss</url>
<releases>
<enabled />
</releases>
<snapshots>
<enabled />
</snapshots>
</repository>
<repository>
<id>eclipse</id>
<url>https://repo.eclipse.org/content/groups/releases/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>jcenter</id>
<url>https://jcenter.bintray.com/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>topobyte</id>
<url>http://mvn.topobyte.de/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>spring</id>
<url>https://repo.spring.io/libs-release/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>rosjava_mvn</id>
<name>Public Rosjava repository</name>
<url>https://github.com/rosjava/rosjava_mvn_repo</url>
</repository>
<repository>
<id>icm</id>
<name>icm</name>
<url>http://maven.icm.edu.pl/artifactory/repo/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>http://central</url>
<releases>
<enabled />
</releases>
<snapshots>
<enabled />
</snapshots>
</pluginRepository>
<pluginRepository>
<id>nexus</id>
<url>https://nexus.se.rwth-aachen.de/content/groups/public</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>central</id>
<url>https://repo1.maven.org/maven2</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>eclipse</id>
<url>https://repo.eclipse.org/content/groups/releases/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>jcenter</id>
<url>https://jcenter.bintray.com/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>topobyte</id>
<url>http://mvn.topobyte.de/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>jena</id>
<url>https://bio.informatik.uni-jena.de/repository/libs-release-oss</url>
<releases>
<enabled />
</releases>
<snapshots>
<enabled />
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>se-nexus</activeProfile>
</activeProfiles>
</settings>
<!-- (c) https://github.com/MontiCore/monticore -->
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2
http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>training-weight</id>
<includeBaseDirectory>false</includeBaseDirectory>
<includeSiteDirectory>false</includeSiteDirectory>
<fileSets>
<fileSet>
<directory>src/main/resources/training_data</directory>
<includes>
<include>**/*.h5</include>
</includes>
</fileSet>
</fileSets>
</assembly>
cmake_minimum_required(VERSION 3.5)
project(DigitCalculator CXX)
set(CMAKE_CXX_STANDARD 11)
option(MXNET_PATH "Path to libmxnet.so")
add_executable(DigitCalculator DigitCalculator.cpp)
set_target_properties(DigitCalculator PROPERTIES LINKER_LANGUAGE CXX)
find_package(OpenCV REQUIRED)
target_link_libraries(DigitCalculator ${MXNET_PATH})
set(INCLUDE_DIRS ${INCLUDE_DIRS} ${OpenCV_INCLUDE_DIRS})
set(LIBS ${LIBS} ${OpenCV_LIBS})
target_link_libraries(DigitCalculator cNNCalculator_connector ${LIBS} -lblas -lopenblas)
target_include_directories(DigitCalculator PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
export(TARGETS DigitCalculator FILE DigitCalculator.cmake)
/* (c) https://github.com/MontiCore/monticore */
#include "CNNTranslator.h"
#include "cNNCalculator_connector.h"
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <armadillo>
#include <string> //Check if it can be removed
#include <iostream>
#include <map>
int main(int argc, char* argv[]) {
if(argc < 7){ //Note: argc=1 if no arguments are provided
std::cout << "Missing argument: Path to 6 test images must be provided " << std::endl;
exit(1);
}
cNNCalculator_connector connector;
connector.init();
for(int n = 0; n < 6; n++) {
std::string filePath = argv[n+1];
if (!std::ifstream(filePath).good()) {
std::cerr << "Image loading failure, test image '" << filePath << "' does not exist." << std::endl;
exit(1);
}
cv::Mat img = cv::imread(filePath);
std::cout << "== original image size: " << img.size() << " ==" << std::endl;
// scale image to fit
cv::Size scale(28,28);
cv::resize(img, img, scale);
std::cout << "== simply resize: " << img.size() << " ==" << std::endl;
size_t channels = 1;
size_t height = img.rows;
size_t width = img.cols;
vector<float> data(channels*height*width);
for(size_t j=0; j<height; j++){
for(size_t k=0; k<width; k++){
cv::Vec3b intensity = img.at<cv::Vec3b>(j, k);
for(size_t i=0; i<channels; i++){
data[i*height*width + j*height + k] = (float) intensity[i];
}
}
}
if(n == 0)
connector.image1 = conv_to< icube >::from( CNNTranslator::translateToCube(data, vector<size_t> {channels,height,width}) );
if(n == 1)
connector.image2 = conv_to< icube >::from( CNNTranslator::translateToCube(data, vector<size_t> {channels,height,width}) );
if(n == 2)
connector.image3 = conv_to< icube >::from( CNNTranslator::translateToCube(data, vector<size_t> {channels,height,width}) );
if(n == 3)
connector.image4 = conv_to< icube >::from( CNNTranslator::translateToCube(data, vector<size_t> {channels,height,width}) );
if(n == 4)
connector.image5 = conv_to< icube >::from( CNNTranslator::translateToCube(data, vector<size_t> {channels,height,width}) );
if(n == 5)
connector.image6 = conv_to< icube >::from( CNNTranslator::translateToCube(data, vector<size_t> {channels,height,width}) );
}
connector.execute();
int classIndex = (int)connector.res;
std::cout << "== SUM: " << classIndex << std::endl;
return 0;
}
/* (c) https://github.com/MontiCore/monticore */
package cNNCalculator;
component Add{
ports
in Z(0:999) num1,
in Z(0:999) num2,
out Z(0:1998) sum;
implementation Math{
sum = num1 + num2;
}
}
/* (c) https://github.com/MontiCore/monticore */
package cNNCalculator;
component ArgMax<Z(1:oo) n = 2>{
ports in Q^{n} inputVector,
out Z(0:oo) maxIndex,
out Q maxValue;
implementation Math{
maxIndex = 0;
maxValue = inputVector(1);
for i = 2:n
if inputVector(i) > maxValue
maxIndex = i - 1;
maxValue = inputVector(i);
end
end
}
}
/* (c) https://github.com/MontiCore/monticore */
package cNNCalculator;
component Calculator {
ports
in Q(0:1)^10 in1_1,
in Q(0:1)^10 in1_2,
in Q(0:1)^10 in1_3,
in Q(0:1)^10 in2_1,
in Q(0:1)^10 in2_2,
in Q(0:1)^10 in2_3,
out Z(0:1998) out1;
instance ArgMax<10> number1_ones;
instance ArgMax<10> number1_tens;
instance ArgMax<10> number1_hundreds;
instance ArgMax<10> number2_ones;
instance ArgMax<10> number2_tens;
instance ArgMax<10> number2_hundreds;
instance DigitCombiner number1;
instance DigitCombiner number2;
instance Add add;
connect in1_1 -> number1_hundreds.inputVector;
connect in1_2 -> number1_tens.inputVector;
connect in1_3 -> number1_ones.inputVector;
connect in2_1 -> number2_hundreds.inputVector;
connect in2_2 -> number2_tens.inputVector;
connect in2_3 -> number2_ones.inputVector;
connect number1_ones.maxIndex -> number1.ones;
connect number1_tens.maxIndex -> number1.tens;
connect number1_hundreds.maxIndex -> number1.hundreds;
connect number2_ones.maxIndex -> number2.ones;
connect number2_tens.maxIndex -> number2.tens;
connect number2_hundreds.maxIndex -> number2.hundreds;
connect number1.number -> add.num1;
connect number2.number -> add.num2;
connect add.sum -> out1;
}
/* (c) https://github.com/MontiCore/monticore */
package cNNCalculator;
component Connector {
ports in Z(0:255)^{1, 28, 28} image1,
in Z(0:255)^{1, 28, 28} image2,
in Z(0:255)^{1, 28, 28} image3,
in Z(0:255)^{1, 28, 28} image4,
in Z(0:255)^{1, 28, 28} image5,