Skip to content
Snippets Groups Projects
Commit 6a28131a authored by Armin Co's avatar Armin Co
Browse files

Benchmark Configurations

parent 4764b70a
No related branches found
No related tags found
No related merge requests found
...@@ -3,7 +3,7 @@ import environment_wrapper as ew ...@@ -3,7 +3,7 @@ import environment_wrapper as ew
import gym import gym
from carla_environment import CarlaEnvironment from carla_environment import CarlaEnvironment
import copy import copy
from tqdm import trange import threading
c = ew.Config() c = ew.Config()
...@@ -22,6 +22,11 @@ smallNet.name = 'SmallNet' ...@@ -22,6 +22,11 @@ smallNet.name = 'SmallNet'
smallNet.net_layout = [128, 32] smallNet.net_layout = [128, 32]
smallNet.conf_to_name() smallNet.conf_to_name()
smallNetDeep = copy.deepcopy(c)
smallNetDeep.name = 'SmallNetDepp'
smallNetDeep.net_layout = [128, 32, 32]
smallNetDeep.conf_to_name()
normalNet = copy.deepcopy(c) normalNet = copy.deepcopy(c)
normalNet.name = 'NormalNet' normalNet.name = 'NormalNet'
normalNet.net_layout = [256, 128] normalNet.net_layout = [256, 128]
...@@ -49,10 +54,41 @@ deepNet.name = 'DeppNet' ...@@ -49,10 +54,41 @@ deepNet.name = 'DeppNet'
deepNet.net_layout = [256, 128, 128] deepNet.net_layout = [256, 128, 128]
deepNet.conf_to_name() deepNet.conf_to_name()
# configurations = [smallNet, normalNet ] littleNet = copy.deepcopy(c)
# configurations = [normalSlowDecay, normalSlowLearn] littleNet.name = 'LittleNet'
configurations = [largeNet, deepNet] littleNet.net_layout = [64, 64]
littleNet.conf_to_name()
verryLittleNet = copy.deepcopy(c)
verryLittleNet.name = 'VerryLittleNet'
verryLittleNet.net_layout = [64, 32]
verryLittleNet.conf_to_name()
verryLittleNetDeep = copy.deepcopy(c)
verryLittleNetDeep.name = 'VerryLittleNetDeep'
verryLittleNetDeep.net_layout = [64, 32, 32]
verryLittleNetDeep.conf_to_name()
# configuration = smallNet
# configuration = smallNetDeep
# configuration = normalNet
# configuration = normalSlowDecay
# configuration = normalSlowLearn
# configuration = largeNet
# configuration = deepNet
# configuration = verryLittleNet
# configuration = littleNet
# configuration = verryLittleNetDeep
# main.run(configuration)
configurations = [smallNet, smallNetDeep, normalNet, normalSlowDecay, normalSlowLearn, largeNet, deepNet, verryLittleNet, littleNet, verryLittleNetDeep]
threads = []
for conf in configurations:
threads.append(threading.Thread(target=main.run, args=conf))
for thread in threads:
thread.start()
configs = trange(len(configurations), desc='Benchmarking configs', unit="Configuration") for thread in threads:
for i in configs: thread.join()
main.run(configurations[i]) \ No newline at end of file
...@@ -106,9 +106,14 @@ def process_logs(avg_score_history, loss, conf): ...@@ -106,9 +106,14 @@ def process_logs(avg_score_history, loss, conf):
df.to_csv(conf.save_to + conf.name + '/' + conf.name + '.csv') df.to_csv(conf.save_to + conf.name + '/' + conf.name + '.csv')
""" Plot the log history """ """ Plot the log history """
plt.figure()
plt.plot([i+1 for i in range(0, len(loss), 2)], loss[::2]) plt.plot([i+1 for i in range(0, len(loss), 2)], loss[::2])
plt.plot([i+1 for i in range(0, len(avg_score_history), 2)], avg_score_history[::2], '--') plt.plot([i+1 for i in range(0, len(avg_score_history), 2)], avg_score_history[::2], '--')
plt.title(conf.name) plt.title(conf.name)
plt.savefig(conf.save_to + conf.name + '/' + conf.name + '.png', format="png") plt.savefig(conf.save_to + conf.name + '/' + conf.name + '.png', format="png")
if conf.render: if conf.render:
plt.show() plt.show()
def load_logs(file):
df = pd.read_csv(file)
return df["Score"], df["Average"]
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment