changing spaces. Debugging ploting
This commit is contained in:
parent
1b89041375
commit
269979d0c7
|
@ -14,7 +14,7 @@ sldist = lambda c1, c2: math.sqrt((c2[0] - c1[0])**2 + (c2[1] - c1[1])**2)
|
|||
class Benchmark(object,):
|
||||
|
||||
# Param @name to be used for saving purposes
|
||||
def __init__(self,city_name,name):
|
||||
def __init__(self,city_name,name,starting_position=0):
|
||||
self._city_name = city_name # The name of the city that is going to be used.
|
||||
self._base_name = name # Sends a base name, the rest will be saved with respect to what the episode was about
|
||||
self._dict_stats = {'exp_id':-1,
|
||||
|
@ -45,6 +45,11 @@ class Benchmark(object,):
|
|||
'pos_y':-1
|
||||
}
|
||||
|
||||
# Returns a experiment class that is build from a benchmark inherited class
|
||||
self._experiments = self._build_experiments()
|
||||
|
||||
self._suffix_name = self._get_experiments_names(self._experiments)
|
||||
|
||||
|
||||
def run_navigation_episode(self, agent,carla, time_out, target):
|
||||
|
||||
|
@ -104,12 +109,10 @@ class Benchmark(object,):
|
|||
return (0, measurement_vec, time_out,distance)
|
||||
|
||||
|
||||
def benchmark_agent(self,agent,carla,starting_position=0):
|
||||
def benchmark_agent(self,agent,carla):
|
||||
|
||||
# The fixed name considering all the experiments being run
|
||||
|
||||
|
||||
experiments = self._build_experiments() # Returns a experiment class that is build from a benchmark inherited class
|
||||
self._suffix_name = self._get_experiments_names(experiments[starting_position:]) # The fixed name considering all the experiments being run
|
||||
with open(self._base_name + self._suffix_name , 'wb') as ofd:
|
||||
|
||||
w = csv.DictWriter(ofd, self._dict_stats.keys())
|
||||
|
@ -126,7 +129,7 @@ class Benchmark(object,):
|
|||
self.write_experiment() # write the experiment being run
|
||||
|
||||
|
||||
for experiment in experiments[starting_position:]:
|
||||
for experiment in self._experiments[starting_position:]:
|
||||
|
||||
|
||||
|
||||
|
@ -208,7 +211,7 @@ class Benchmark(object,):
|
|||
with open('rewards_' + self._base_name + self._suffix_name , 'a+') as rfd:
|
||||
|
||||
rw = csv.DictWriter(rfd, self._dict_rewards.keys())
|
||||
rw.writeheader()
|
||||
|
||||
|
||||
|
||||
for i in range(len(reward_vec)):
|
||||
|
|
|
@ -1,3 +1,11 @@
|
|||
# Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma de
|
||||
# Barcelona (UAB), and the INTEL Visual Computing Lab.
|
||||
#
|
||||
# This work is licensed under the terms of the MIT license.
|
||||
# For a copy, see <https://opensource.org/licenses/MIT>.
|
||||
|
||||
# CORL experiment set.
|
||||
|
||||
|
||||
from .benchmark import Benchmark
|
||||
from .experiment import Experiment
|
||||
|
@ -74,9 +82,13 @@ class CoRL(Benchmark):
|
|||
|
||||
|
||||
def _build_experiments(self):
|
||||
""" Creates the whole set of experiment objects,
|
||||
The experiments created depend on the selected Town.
|
||||
"""
|
||||
|
||||
# We set the camera
|
||||
# This single RGB camera is used on every experiment
|
||||
|
||||
# We set the camera that is going to be used for all experiments
|
||||
camera = Camera('CameraRGB')
|
||||
camera.set(CameraFOV=100)
|
||||
|
||||
|
@ -136,5 +148,7 @@ class CoRL(Benchmark):
|
|||
experiments_vector.append(experiment)
|
||||
|
||||
return experiments_vector
|
||||
def _get_details(self): # Function to get automatic information from the experiment for writing purposes
|
||||
|
||||
def _get_details(self):
|
||||
# Function to get automatic information from the experiment for writing purposes
|
||||
return 'corl_' + self._city_name
|
|
@ -278,12 +278,7 @@ def plot_summary(file,summary_weathers):
|
|||
print 'Avg completion', summaries[sw]['completion']/summaries[sw]['num_weathers']
|
||||
print 'Avg infractions'
|
||||
print_infractions(summaries[sw]['infractions']/summaries[sw]['num_weathers'])
|
||||
#
|
||||
#
|
||||
#infractions_vec = [sum(x) for x in zip(infractions, infractions_vec)]
|
||||
#print 'Non_Colisions/Km', (infractions[1]+ infractions[0])/2.0 ,'Lane Cross/Km ',infractions[0],'Side Cross/Km ',infractions[1],'Col Gen /Km ',infractions[2]\
|
||||
#,'Col Ped /Km ',infractions[3],'Col Ped /Km ',infractions[4], 'Acidents/Km ', (infractions[4] +infractions[2] + infractions[3])/3,\
|
||||
#'total', 1/((infractions[4] +infractions[2] + infractions[3] + infractions[1] + infractions[0])/5.0)
|
||||
|
||||
|
||||
return summaries
|
||||
|
||||
|
|
Loading…
Reference in New Issue