Commit 65bfd1fd authored by Svetlana Pavlitskaya's avatar Svetlana Pavlitskaya

minor changes in Dpnet and affordance indicators

parent f0cebd01
......@@ -2,8 +2,10 @@ configuration Dpnet{
num_epoch : 100
batch_size : 64
context:cpu
normalize: true
optimizer : sgd{
learning_rate : 0.01
weight_decay : 0.0005
}
}
component Dpnet{
ports in Z(0:255)^{3, 210, 280} image,
out Q(0:1)^{13,1,1} predictions;
out Q(-oo:oo)^{14,1,1} predictions;
implementation CNN {
......@@ -23,8 +23,7 @@ component Dpnet{
conv(kernel=(3,3), channels=256) ->
fc() ->
fc() ->
FullyConnected(units=13) ->
Sigmoid() ->
FullyConnected(units=14, no_bias=true) ->
predictions
}
......
This diff is collapsed.
......@@ -10,10 +10,16 @@ if __name__ == "__main__":
dpnet = CNNCreator_dpnet.CNNCreator_dpnet()
dpnet.train(
batch_size = 64,
num_epoch = 5,
batch_size = 64,
num_epoch = 100,
context = 'cpu',
normalize = True,
optimizer = 'sgd',
optimizer_params = {
'learning_rate': 0.01}
'weight_decay': 5.0E-4,
'learning_rate': 0.01}
)
......@@ -7,9 +7,10 @@ import plyvel
import tarfile
import os
ARCHIVE = True
CHUNK_SIZE = 10000
LEVELDB_PATH = "/media/sveta/4991e634-dd81-4cb9-bf46-2fa9c7159263/TORCS_Training_1F"
HDF5_PATH = "/media/sveta/4991e634-dd81-4cb9-bf46-2fa9c7159263/TORCS_HDF5"
HDF5_PATH = "/media/sveta/4991e634-dd81-4cb9-bf46-2fa9c7159263/TORCS_HDF5_2"
def main():
......@@ -47,17 +48,18 @@ def write_to_hdf5(images, indicators, file_idx, start_date):
f.close()
print("Finished dumping to file " + filename)
init_end_date = datetime.datetime.now()
elapsed_time = init_end_date - start_date
print("Dumping took " + str(elapsed_time))
# archive and remove original file
tar = tarfile.open(filename + ".tar.bz2", 'w:bz2')
os.chdir(HDF5_PATH)
tar.add("train_" + str(file_idx) + ".h5")
tar.close()
os.remove(filename)
if ARCHIVE:
# archive and remove original file
tar = tarfile.open(filename + ".tar.bz2", 'w:bz2')
os.chdir(HDF5_PATH)
tar.add("train_" + str(file_idx) + ".h5")
tar.close()
os.remove(filename)
current_time = datetime.datetime.now()
elapsed_time = current_time - start_date
print("Finished archiving. Total time spent: " + str(elapsed_time))
def normalize(indicators):
......
......@@ -4,4 +4,5 @@ scikit-image
protobuf
leveldb
tables
glog
\ No newline at end of file
glog
mxnet
\ No newline at end of file
......@@ -3,21 +3,21 @@ package dp.subcomponents;
struct Affordance {
Q(-0.5rad:0.001rad:0.5rad) angle;
Q(-7m:0.01m:-2.5m) toMarkingL;
Q(-2m:0.01m:3.5m) toMarkingM;
Q(2.5m:0.01m:7m) toMarkingR;
Q(0m:0.1m:75m) distL;
Q(0m:0.1m:75m) distR;
Q(-7m : 0.01m : -2.5m) toMarkingL;
Q(-2m : 0.01m : 3.5m) toMarkingM;
Q(2.5m : 0.01m : 7m) toMarkingR;
Q(0m : 0.1m : 75m) distL;
Q(0m : 0.1m : 75m) distR;
Q(-9.5m:0.01m:-4m) toMarkingLL;
Q(-5.5m:0.01m:-0.5m) toMarkingML;
Q(0.5m:0.01m:5.5m) toMarkingMR;
Q(4m:0.01m:9.5m) toMarkingRR;
Q(0m:0.1m:75m) distLL;
Q(0m:0.1m:75m) distMM;
Q(0m:0.1m:75m) distRR;
Q(-9.5m : 0.01m : -4m) toMarkingLL;
Q(-5.5m : 0.01m : -0.5m) toMarkingML;
Q(0.5m : 0.01m : 5.5m) toMarkingMR;
Q(4m : 0.01m : 9.5m) toMarkingRR;
Q(0m : 0.1m : 75m) distLL;
Q(0m : 0.1m : 75m) distMM;
Q(0m : 0.1m : 75m) distRR;
Q(0:0.1:1) fast;
Q(0 : 0.1 : 1) fast;
}
......@@ -2,6 +2,7 @@ configuration Dpnet{
num_epoch : 100
batch_size : 64
context:cpu
normalize:true
optimizer : sgd{
learning_rate : 0.01
}
......
......@@ -2,7 +2,7 @@ package dp.subcomponents;
component Dpnet{
ports in Z(0:255)^{3, 210, 280} image,
out Q(0:1)^{14,1,1} predictions;
out Q(-oo:oo)^{14,1,1} predictions;
implementation CNN {
......@@ -25,8 +25,8 @@ component Dpnet{
conv(kernel=(3,3), channels=256) ->
fc() ->
fc() ->
FullyConnected(units=13) ->
Sigmoid() ->
FullyConnected(units=14, no_bias=true) ->
predictions
}
}
......@@ -5,66 +5,66 @@ component Unnormalizer {
out Affordance affordance;
implementation Math {
oldMin = 0.1
oldMax = 0.9
oldRange = oldMax - oldMin
Q oldMin = 0.1;
Q oldMax = 0.9;
Q oldRange = oldMax - oldMin;
newMin = -0.5
newMax = 0.5
newRange = newMax - newMin
affordance.angle = (((normalizedPredictions(0,0,0) - oldMin) * newRange) / oldRange) + newMin
newMin = -7
newMax = -2.5
newRange = newMax - newMin
affordance.toMarkingL = (((normalizedPredictions(0,0,1) - oldMin) * newRange) / oldRange) + newMin
newMin = -2
newMax = 3.5
newRange = newMax - newMin
affordance.toMarkingM = (((normalizedPredictions(0,0,2) - oldMin) * newRange) / oldRange) + newMin
newMin = 2.5
newMax = 7
newRange = newMax - newMin
affordance.toMarkingR = (((normalizedPredictions(0,0,3) - oldMin) * newRange) / oldRange) + newMin
newMin = 0
newMax = 75
newRange = newMax - newMin
affordance.distL = (((normalizedPredictions(0,0,4) - oldMin) * newRange) / oldRange) + newMin
affordance.distR = (((normalizedPredictions(0,0,5) - oldMin) * newRange) / oldRange) + newMin
newMin = -9.5
newMax = -4
newRange = newMax - newMin
affordance.toMarkingLL = (((normalizedPredictions(0,0,6) - oldMin) * newRange) / oldRange) + newMin
Q newMin = -0.5;
Q newMax = 0.5;
Q newRange = newMax - newMin;
affordance.angle = (((normalizedPredictions(0,0,0) - oldMin) * newRange) / oldRange) + newMin;
newMin = -5.5
newMax = -0.5
newRange = newMax - newMin
affordance.toMarkingML = (((normalizedPredictions(0,0,7) - oldMin) * newRange) / oldRange) + newMin
newMin = 0.5
newMax = 5.5
newRange = newMax - newMin
affordance.toMarkingMR = (((normalizedPredictions(0,0,8) - oldMin) * newRange) / oldRange) + newMin
newMin = -7;
newMax = -2.5;
newRange = newMax - newMin;
affordance.toMarkingL = (((normalizedPredictions(0,0,1) - oldMin) * newRange) / oldRange) + newMin;
newMin = 4
newMax = 9.5
newRange = newMax - newMin
affordance.toMarkingRR = (((normalizedPredictions(0,0,9) - oldMin) * newRange) / oldRange) + newMin
newMin = 0
newMax = 75
newRange = newMax - newMin
affordance.distLL = (((normalizedPredictions(0,0,10) - oldMin) * newRange) / oldRange) + newMin
affordance.distMM = (((normalizedPredictions(0,0,11) - oldMin) * newRange) / oldRange) + newMin
affordance.distRR = (((normalizedPredictions(0,0,12) - oldMin) * newRange) / oldRange) + newMin
newMin = -2;
newMax = 3.5;
newRange = newMax - newMin;
affordance.toMarkingM = (((normalizedPredictions(0,0,2) - oldMin) * newRange) / oldRange) + newMin;
newMin = 0
newMax = 1
newRange = newMax - newMin
affordance.fast = (((normalizedPredictions(0,0,13) - oldMin) * newRange) / oldRange) + newMin
newMin = 2.5;
newMax = 7;
newRange = newMax - newMin;
affordance.toMarkingR = (((normalizedPredictions(0,0,3) - oldMin) * newRange) / oldRange) + newMin;
newMin = 0;
newMax = 75;
newRange = newMax - newMin;
affordance.distL = (((normalizedPredictions(0,0,4) - oldMin) * newRange) / oldRange) + newMin;
affordance.distR = (((normalizedPredictions(0,0,5) - oldMin) * newRange) / oldRange) + newMin;
newMin = -9.5;
newMax = -4;
newRange = newMax - newMin;
affordance.toMarkingLL = (((normalizedPredictions(0,0,6) - oldMin) * newRange) / oldRange) + newMin;
newMin = -5.5;
newMax = -0.5;
newRange = newMax - newMin;
affordance.toMarkingML = (((normalizedPredictions(0,0,7) - oldMin) * newRange) / oldRange) + newMin;
newMin = 0.5;
newMax = 5.5;
newRange = newMax - newMin;
affordance.toMarkingMR = (((normalizedPredictions(0,0,8) - oldMin) * newRange) / oldRange) + newMin;
newMin = 4;
newMax = 9.5;
newRange = newMax - newMin;
affordance.toMarkingRR = (((normalizedPredictions(0,0,9) - oldMin) * newRange) / oldRange) + newMin;
newMin = 0;
newMax = 75;
newRange = newMax - newMin;
affordance.distLL = (((normalizedPredictions(0,0,10) - oldMin) * newRange) / oldRange) + newMin;
affordance.distMM = (((normalizedPredictions(0,0,11) - oldMin) * newRange) / oldRange) + newMin;
affordance.distRR = (((normalizedPredictions(0,0,12) - oldMin) * newRange) / oldRange) + newMin;
newMin = 0;
newMax = 1;
newRange = newMax - newMin;
affordance.fast = (((normalizedPredictions(0,0,13) - oldMin) * newRange) / oldRange) + newMin;
}
}
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