Exemplo n.º 1
0
    # "track_distance_projected_along_half_angle_vec_exit",
    "lane_distance_along_curve_secant_entry",   # Distance of lane center line to curve secant ceter point at 0 degree angle
    # "lane_distance_along_curve_secant_exit",    # Distance of lane center line to curve secant ceter point at 180 degree angle
    # "oneway_entry",                             # Is entry way a oneway street?
    # "oneway_exit",                              # Is exit way a oneway street?
    "curvature_entry",                          # Curvature of entry way over INT_DIST
    # "curvature_exit",                           # Curvature of exit way over INT_DIST
    "vehicle_speed_entry",                      # Measured vehicle speed on entry way at INT_DIST
    # "vehicle_speed_exit",                       # Measured vehicle speed on exit way at INT_DIST
    # "lane_count_entry",                         # Total number of lanes in entry way
    # "lane_count_exit",                          # Total number of lanes in exit way
    # "has_right_of_way",                         # Does the vehicle with the respective manoeuver have right of way at the intersection?
    "curve_secant_dist"
]

kitti_samples = automatic_test.load_samples('../data/training_data/samples_kitti/samples.pickle')
darmstadt_samples = automatic_test.load_samples('../data/training_data/samples_darmstadt/samples.pickle')
samples = kitti_samples + darmstadt_samples
select_label_method(samples, 'y_distances')
random.shuffle(samples)
sub_samples, test_samples = automatic_test.get_partitioned_samples(samples, 0.8)
train_samples, validation_samples = automatic_test.get_partitioned_samples(sub_samples, 0.75)
# train_samples, validation_samples = automatic_test.get_cross_validation_samples(sub_samples, 4)

rf_algo = regressors.RandomForestAlgorithm(feature_list, single_target_variable=False, random_state=random, n_estimators=27, max_features=12, max_leaf_nodes=5)
rf_algo2 = regressors.RandomForestAlgorithm(feature_list2, single_target_variable=False, random_state=random, n_estimators=35, max_features=5, max_leaf_nodes=8)
algos = [rf_algo, rf_algo2]
results = automatic_test.test(algos, train_samples, test_samples, cross_validation=False)
# automatic_test.show_intersection_plot(results, test_samples, which_samples="best-worst-case", orientation="curve-secant")
automatic_test.show_intersection_plot(results, validation_samples, which_samples="all", orientation="curve-secant")
Exemplo n.º 2
0
import reference_implementations

feature_list = [
    "intersection_angle",                       # Angle between entry and exit way
    "maxspeed_entry",                           # Allowed maximum speed on entry way
    "maxspeed_exit",                            # Allowed maximum speed on exit way
    "lane_distance_entry_exact",                # Distance of track line to curve secant center point at 0 degree angle
    "lane_distance_exit_exact",                 # Distance of track line to curve secant center point at 180 degree angle
    "oneway_entry",                             # Is entry way a oneway street?
    "oneway_exit",                              # Is exit way a oneway street?
    "curvature_entry",                          # Curvature of entry way over INT_DIST
    "curvature_exit",                           # Curvature of exit way over INT_DIST
    "vehicle_speed_entry",                      # Measured vehicle speed on entry way at INT_DIST
    "vehicle_speed_exit",                       # Measured vehicle speed on exit way at INT_DIST
    "lane_count_entry",                         # Total number of lanes in entry way
    "lane_count_exit",                          # Total number of lanes in exit way
    "has_right_of_way",                         # Does the vehicle with the respective manoeuver have right of way at the intersection?
    "curve_secant_dist"                         # Shortest distance from curve secant to intersection center
]
samples = automatic_test.load_samples('../data/training_data/samples.pickle')
samples = automatic_test.normalize_features(samples)
train_samples, test_samples = automatic_test.get_partitioned_samples(samples, 0.7)
automatic_test.test_feature_permutations(
                    regressors.RandomForestAlgorithm,
                    train_samples,
                    test_samples,
                    feature_list,
                    min_num_features=10,
                    raise_feature_num=False,
                    cross_validation=False)
Exemplo n.º 3
0
import reference_implementations
from extract_features import _feature_types, select_label_method, get_half_angle_vec
import extract_features
from plot_helper import plot_intersection, get_heatmap_from_distances_all_predictors, get_heatmap_from_polar_all_predictors
import numpy.random as random

feature_list = _feature_types

rf_algo = regressors.RandomForestAlgorithm(feature_list)
kitti_samples = automatic_test.load_samples('../data/training_data/samples_kitti/samples.pickle')
darmstadt_samples = automatic_test.load_samples('../data/training_data/samples_darmstadt/samples.pickle')
extract_features.select_label_method(kitti_samples, 'y_radii')
extract_features.select_label_method(darmstadt_samples, 'y_radii')
random.shuffle(kitti_samples)
random.shuffle(darmstadt_samples)
kitti_train_samples, kitti_test_samples = automatic_test.get_partitioned_samples(kitti_samples, 0.7)
darmstadt_train_samples, darmstadt_test_samples = automatic_test.get_partitioned_samples(darmstadt_samples, 0.7)
train_samples = kitti_train_samples + darmstadt_train_samples
test_samples = kitti_test_samples + darmstadt_test_samples

# samples = automatic_test.load_samples('../data/training_data/samples.pickle')
# # samples = automatic_test.normalize_features(samples)
# select_label_method(samples, 'y_distances')
# train_samples, test_samples = automatic_test.get_partitioned_samples(samples, 0.8)
# #automatic_test.test([rf_algo], train_samples, test_samples, cross_validation=False)
automatic_test.train([rf_algo], train_samples)
results = automatic_test.predict_all_estimators([rf_algo], test_samples)

for sample, prediction, predictions_all_estimators in zip(test_samples, results[rf_algo]['predictions'], results[rf_algo]['predictions_all_estimators']):
    predicted_distances = [pred[0] for pred in predictions_all_estimators]
Exemplo n.º 4
0
sys.path.append('../')
import automatic_test
import regressors
import reference_implementations
import numpy as np
import matplotlib.pyplot as plt

feature_list = [
    "lane_distance_entry_exact",
    "curve_secant_dist",
    "lane_distance_exit_exact",
    "maxspeed_entry",
    "vehicle_speed_entry",
    "vehicle_speed_exit",
    "curvature_exit",
    "oneway_exit",
    "lane_count_entry",
    "has_right_of_way",
    "curvature_entry"
]

kitti_samples = automatic_test.load_samples('../data/training_data/samples_23_09_15/samples.pickle')
kitti_samples = automatic_test.normalize_features(kitti_samples)
cmu_samples = automatic_test.load_samples('../data/training_data/samples_CMU/samples.pickle')
cmu_samples = automatic_test.normalize_features(cmu_samples)
kitti_train_samples, kitti_test_samples = automatic_test.get_partitioned_samples(kitti_samples, 0.8)

rf_algo = regressors.RandomForestAlgorithm(feature_list)
automatic_test.test([rf_algo], kitti_train_samples, kitti_test_samples, cross_validation=False)
automatic_test.test([rf_algo], kitti_train_samples, cmu_samples, cross_validation=False)
Exemplo n.º 5
0
    "oneway_exit",  # Is exit way a oneway street?
    "curvature_entry",  # Curvature of entry way over INT_DIST
    "curvature_exit",  # Curvature of exit way over INT_DIST
    "bicycle_designated_entry",  # Is there a designated bicycle way in the entry street?
    "bicycle_designated_exit",  # Is there a designated bicycle way in the exit street?
    "lane_count_entry",  # Total number of lanes in entry way
    "lane_count_exit",  # Total number of lanes in exit way
    "has_right_of_way",  # Does the vehicle with the respective manoeuver have right of way at the intersection?
    "curve_secant_dist",  # Shortest distance from curve secant to intersection center
]

kitti_samples = automatic_test.load_samples("../data/training_data/samples_15_10_08/samples.pickle")
darmstadt_samples = automatic_test.load_samples("../data/training_data/samples_15_10_20_darmstadt/samples.pickle")
extract_features.select_label_method(kitti_samples, "y_distances")
extract_features.select_label_method(darmstadt_samples, "y_distances")
train_kitti, test_kitti = automatic_test.get_partitioned_samples(kitti_samples, 0.7)
train_darmstadt, test_darmstadt = automatic_test.get_partitioned_samples(darmstadt_samples, 0.7)
train_samples = train_kitti + train_darmstadt
test_samples = test_kitti + test_darmstadt
rf_algo = regressors.RandomForestAlgorithm(feature_list)

print "###### Non-rectified data ######"
print "------ Only KITTI ------"
automatic_test.test([rf_algo], train_kitti, test_kitti, cross_validation=False)
print "------ KITTI + Darmstadt ------"
automatic_test.test([rf_algo], train_samples, test_samples, cross_validation=False)

print "###### Rectified data ######"
kitti_samples_rectified = automatic_test.load_samples("../data/training_data/samples_15_10_08_rectified/samples.pickle")
darmstadt_samples_rectified = automatic_test.load_samples(
    "../data/training_data/samples_15_10_20_darmstadt_rectified/samples.pickle"
Exemplo n.º 6
0
    "curvature_exit",                           # Curvature of exit way over INT_DIST
    "bicycle_designated_entry",                 # Is there a designated bicycle way in the entry street?
    "bicycle_designated_exit",                  # Is there a designated bicycle way in the exit street?
    "lane_count_entry",                         # Total number of lanes in entry way
    "lane_count_exit",                          # Total number of lanes in exit way
    "has_right_of_way",                         # Does the vehicle with the respective manoeuver have right of way at the intersection?
    "curve_secant_dist"                         # Shortest distance from curve secant to intersection center
]

rf_algo = regressors.RandomForestAlgorithm(feature_list)
is_algo = reference_implementations.InterpolatingSplineAlgorithm()
kitti_samples = automatic_test.load_samples('../data/training_data/samples_15_10_12_rectified/samples.pickle')
darmstadt_samples = automatic_test.load_samples('../data/training_data/samples_15_10_20_darmstadt_rectified/samples.pickle')
select_label_method(kitti_samples, 'y_distances')
select_label_method(darmstadt_samples, 'y_distances')
train_samples_kitti, test_samples_kitti = automatic_test.get_partitioned_samples(kitti_samples, 0.7)
train_samples_darmstadt, test_samples_darmstadt = automatic_test.get_partitioned_samples(darmstadt_samples, 0.7)
train_samples = train_samples_kitti + train_samples_darmstadt
test_samples = test_samples_darmstadt + test_samples_kitti
automatic_test.train([rf_algo], train_samples)
results = automatic_test.predict_all_estimators([rf_algo], test_samples)
is_results = automatic_test.predict([is_algo], test_samples)

for sample, rf_prediction, rf_predictions_all_estimators, is_prediction in zip(test_samples,
                                                            results[rf_algo]['predictions'],
                                                            results[rf_algo]['predictions_all_estimators'],
                                                            is_results[is_algo]['predictions']):
    predicted_distances = [pred[0] for pred in rf_predictions_all_estimators]
    half_angle_vec = get_half_angle_vec(sample['geometry']['exit_line'], sample['X'][_feature_types.index('intersection_angle')])
    heatmap = get_heatmap_from_distances_all_predictors(predicted_distances,
                                                    sample['geometry']['entry_line'],