Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
T
torcs_dl
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
autonomousdriving
torcs_dl
Commits
e59ba214
Commit
e59ba214
authored
May 15, 2018
by
Svetlana Pavlitskaya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
EMADL component and config to train a direct perception network as described in DeepDriving paper
parent
1b75471b
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
41 additions
and
191 deletions
+41
-191
CNNModelTraining/src/main/java/de/monticore/lang/monticar/torcs_dl/CNNCodeGenerator.java
...de/monticore/lang/monticar/torcs_dl/CNNCodeGenerator.java
+3
-3
CNNModelTraining/src/main/models/Alexnet.emadl
CNNModelTraining/src/main/models/Alexnet.emadl
+0
-47
CNNModelTraining/src/main/models/AlexnetConfig.cnnt
CNNModelTraining/src/main/models/AlexnetConfig.cnnt
+0
-7
CNNModelTraining/src/main/models/Dpnet.cnnt
CNNModelTraining/src/main/models/Dpnet.cnnt
+7
-0
CNNModelTraining/src/main/models/Dpnet.emadl
CNNModelTraining/src/main/models/Dpnet.emadl
+31
-0
CNNModelTraining/src/main/resources/de/monticore/lang/monticar/generator/middleware/IAdapterTemplate.ftl
...e/lang/monticar/generator/middleware/IAdapterTemplate.ftl
+0
-9
CNNModelTraining/src/main/resources/de/monticore/lang/monticar/generator/middleware/cmakeCppTemplate.ftl
...e/lang/monticar/generator/middleware/cmakeCppTemplate.ftl
+0
-6
CNNModelTraining/src/main/resources/de/monticore/lang/monticar/generator/middleware/coordinatorCmakeListsTemplate.ftl
...ar/generator/middleware/coordinatorCmakeListsTemplate.ftl
+0
-13
CNNModelTraining/src/main/resources/de/monticore/lang/monticar/generator/middleware/coordinatorTemplate.ftl
...ang/monticar/generator/middleware/coordinatorTemplate.ftl
+0
-81
CNNModelTraining/src/main/resources/de/monticore/lang/monticar/generator/middleware/struct_msgsCmakeTemplate.ftl
...onticar/generator/middleware/struct_msgsCmakeTemplate.ftl
+0
-25
No files found.
CNNModelTraining/src/main/java/de/monticore/lang/monticar/torcs_dl/CNNCodeGenerator.java
View file @
e59ba214
package
de.monticore.lang.monticar.torcs_dl
;
import
de.monticore.lang.monticar.emadl.generator.Generator
;
import
de.monticore.lang.monticar.emadl.generator.
EMADL
Generator
;
import
freemarker.template.TemplateException
;
import
java.io.IOException
;
...
...
@@ -17,10 +17,10 @@ public class CNNCodeGenerator {
public
static
void
main
(
String
[]
args
)
{
System
.
out
.
println
(
"Starting code generation..."
);
Generator
gen
=
new
Generator
();
EMADLGenerator
gen
=
new
EMADL
Generator
();
gen
.
setGenerationTargetPath
(
TARGET_PATH_GENERATED
);
try
{
gen
.
generate
(
MODELS_PATH
,
"
Alex
net"
);
gen
.
generate
(
MODELS_PATH
,
"
Dp
net"
);
}
catch
(
IOException
|
TemplateException
e
)
{
e
.
printStackTrace
();
}
...
...
CNNModelTraining/src/main/models/Alexnet.emadl
deleted
100644 → 0
View file @
1b75471b
component Alexnet{
ports in Z(0:255)^{3, 224, 224} image,
out Q(0:1)^{10,1,1} predictions;
implementation CNN {
def split1(i){
[i] ->
Convolution(kernel=(5,5), channels=128) ->
Lrn(nsize=5, alpha=0.0001, beta=0.75) ->
Pooling(pool_type="max", kernel=(3,3), stride=(2,2), padding="no_loss") ->
Relu()
}
def split2(i){
[i] ->
Convolution(kernel=(3,3), channels=192) ->
Relu() ->
Convolution(kernel=(3,3), channels=128) ->
Pooling(pool_type="max", kernel=(3,3), stride=(2,2), padding="no_loss") ->
Relu()
}
def fc(){
FullyConnected(units=4096) ->
Relu() ->
Dropout()
}
image ->
Convolution(kernel=(11,11), channels=96, stride=(4,4), padding="no_loss") ->
Lrn(nsize=5, alpha=0.0001, beta=0.75) ->
Pooling(pool_type="max", kernel=(3,3), stride=(2,2), padding="no_loss") ->
Relu() ->
Split(n=2) ->
split1(i=[0|1]) ->
Concatenate() ->
Convolution(kernel=(3,3), channels=384) ->
Relu() ->
Split(n=2) ->
split2(i=[0|1]) ->
Concatenate() ->
fc(->=2) ->
FullyConnected(units=10) ->
Softmax() ->
predictions
}
}
\ No newline at end of file
CNNModelTraining/src/main/models/AlexnetConfig.cnnt
deleted
100644 → 0
View file @
1b75471b
configuration AlexnetConfig{
num_epoch : 100
batch_size : 500
optimizer : adam{
learning_rate : 0.001
}
}
CNNModelTraining/src/main/models/Dpnet.cnnt
0 → 100644
View file @
e59ba214
configuration Dpnet{
num_epoch : 100
batch_size : 64
optimizer : sgd{
learning_rate : 0.01
}
}
CNNModelTraining/src/main/models/Dpnet.emadl
0 → 100644
View file @
e59ba214
component Dpnet{
ports in Z(0:255)^{3, 210, 280} image,
out Q(0:1)^{13,1,1} predictions;
implementation CNN {
def conv(kernel, channels, hasPool=true, convStride=(1,1)){
Convolution(kernel=kernel, channels=channels, stride=convStride) ->
Relu() ->
Pooling(pool_type="max", kernel=(3,3), stride=(2,2), ?=hasPool)
}
def fc(){
FullyConnected(units=4096) ->
Relu() ->
Dropout()
}
image ->
conv(kernel=(11,11), channels=96, convStride=(4,4)) ->
conv(kernel=(5,5), channels=256, convStride=(4,4)) ->
conv(kernel=(3,3), channels=384, hasPool=false) ->
conv(kernel=(3,3), channels=384, hasPool=false) ->
conv(kernel=(3,3), channels=256) ->
fc() ->
fc() ->
FullyConnected(units=13) ->
Sigmoid() ->
predictions
}
}
CNNModelTraining/src/main/resources/de/monticore/lang/monticar/generator/middleware/IAdapterTemplate.ftl
deleted
100644 → 0
View file @
1b75471b
#pragma once
#include "${compName}.h"
class IAdapter_${compName}{
public:
virtual ~IAdapter_${compName}(){}
virtual void init(${compName}* comp) = 0;
virtual void tick() = 0;
};
CNNModelTraining/src/main/resources/de/monticore/lang/monticar/generator/middleware/cmakeCppTemplate.ftl
deleted
100644 → 0
View file @
1b75471b
cmake_minimum_required(VERSION 3.5)
project(${compName} LANGUAGES CXX)
add_library(${compName} ${compName}.h)
target_include_directories(${compName} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
set_target_properties(${compName} PROPERTIES LINKER_LANGUAGE CXX)
export(TARGETS ${compName} FILE ${compName}.cmake)
CNNModelTraining/src/main/resources/de/monticore/lang/monticar/generator/middleware/coordinatorCmakeListsTemplate.ftl
deleted
100644 → 0
View file @
1b75471b
cmake_minimum_required(VERSION 3.5)
project (Coordinator_${compName} CXX)
set (CMAKE_CXX_STANDARD 11)
set (THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
add_executable(Coordinator_${compName} Coordinator_${compName}.cpp)
set_target_properties(Coordinator_${compName} PROPERTIES LINKER_LANGUAGE CXX)
target_link_libraries(Coordinator_${compName} ${targets} Threads::Threads)
target_include_directories(Coordinator_${compName} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
export(TARGETS Coordinator_${compName} FILE Coordinator_${compName}.cmake)
\ No newline at end of file
CNNModelTraining/src/main/resources/de/monticore/lang/monticar/generator/middleware/coordinatorTemplate.ftl
deleted
100644 → 0
View file @
1b75471b
#include <iostream>
#include <thread>
#include <chrono>
#include <atomic>
#include <list>
#include "IAdapter_${compName}.h"
${includes}
using namespace std;
using namespace chrono;
static int exeMs = 100;
bool parseCommandLineParameters(int argc, char* argv[]){
if(argc == 1){
return true;
}
if(argc == 3 && string(argv[1]) == "-t"){
try{
int tmp = stoi(argv[2]);
if(tmp >= 0){
exeMs = tmp;
return true;
}
}catch(...){
//Ignore
}
}
cout << "Usage: " << argv[0] << " [-h | -t sleepTimeMs]\n";
return false;
}
void startMiddleware(IAdapter_${compName}& adapter,${compName}& comp,atomic<bool>& done){
adapter.init(&comp);
done = true;
}
int main(int argc, char* argv[])
{
if(!parseCommandLineParameters(argc,argv)){
return 1;
}
atomic<bool> done(false);
${compName} comp;
comp.init();
list<IAdapter_${compName}*> adapters;
${addAdapters}
list<thread*> threads;
for(auto a : adapters){
threads.push_back(new thread(startMiddleware,ref(*a),ref(comp),ref(done)));
}
cout << "waiting for all middleware to start\n";
this_thread::sleep_for(seconds(3));
cout << "started! Executing every " << exeMs << "ms\n";
time_point<system_clock> start, end;
while(!done){
start = system_clock::now();
comp.execute();
for(auto a : adapters){
(*a).tick();
}
end = system_clock::now();
int elapsedMs = duration_cast<milliseconds>(end-start).count();
int newSleep = exeMs - elapsedMs;
if(newSleep <= 0){
cout << "Cant keep up! "<< (-newSleep) <<"ms late!\n";
}else{
this_thread::sleep_for(milliseconds(newSleep));
}
}
return 0;
}
\ No newline at end of file
CNNModelTraining/src/main/resources/de/monticore/lang/monticar/generator/middleware/struct_msgsCmakeTemplate.ftl
deleted
100644 → 0
View file @
1b75471b
cmake_minimum_required(VERSION 3.5)
project (struct_msgs)
find_package(genmsg REQUIRED)
FILE(GLOB MSG_FILES_RAW RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ../*/roscpp/struct_msgs/*.msg)
#generate struct_msgs iff .msg files where found
if(MSG_FILES_RAW)
#filter: add each struct msg only once (distinct by filename without path)
foreach(CUR_MSG_FILE ${MSG_FILES_RAW})
get_filename_component(TMP_MSG_NAME ${CUR_MSG_FILE} NAME)
IF(NOT MSG_DEFINED_${TMP_MSG})
LIST(APPEND MSG_FILES ${CUR_MSG_FILE})
SET(MSG_DEFINED_${TMP_MSG} TRUE)
ENDIF()
endforeach(CUR_MSG_FILE)
#generate messages
add_message_files(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} FILES ${MSG_FILES})
generate_messages()
#export the include_dirs, so that other subprojects can use it
set(struct_msgs_INCLUDE_DIRS ${struct_msgs_INCLUDE_DIRS} PARENT_SCOPE)
endif()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment