-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
96f87eb
commit a06ae73
Showing
12 changed files
with
2,859 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
####################################################################################################### | ||
# This file is borrowed from COiLTRAiNE https://github.com/felipecode/coiltraine by Felipe Codevilla # | ||
# COiLTRAiNE itself is under MIT License # | ||
####################################################################################################### | ||
|
||
|
||
import imgaug as ia | ||
from imgaug import augmenters as iaa | ||
|
||
|
||
def hard(image_iteration): | ||
|
||
iteration = image_iteration/32 | ||
frequency_factor = min(0.05 + float(iteration)/200000.0, 1.0) | ||
color_factor = min(float(iteration)/1000000.0, 1.0) | ||
dropout_factor = 0.198667 + (0.03856658 - 0.198667) / (1 + (iteration / 196416.6) ** 1.863486) | ||
|
||
blur_factor = min(0.5 + (0.5*iteration/100000.0), 1.0) | ||
|
||
add_factor = 10 + 10*iteration/100000.0 | ||
|
||
multiply_factor_pos = 1 + (2.5*iteration/200000.0) | ||
multiply_factor_neg = 1 - (0.91 * iteration / 500000.0) | ||
|
||
contrast_factor_pos = 1 + (0.5*iteration/500000.0) | ||
contrast_factor_neg = 1 - (0.5 * iteration / 500000.0) | ||
|
||
augmenter = iaa.Sequential([ | ||
|
||
iaa.Sometimes(frequency_factor, iaa.GaussianBlur((0, blur_factor))), | ||
# blur images with a sigma between 0 and 1.5 | ||
iaa.Sometimes(frequency_factor, iaa.AdditiveGaussianNoise(loc=0, scale=(0.0, dropout_factor), | ||
per_channel=color_factor)), | ||
# add gaussian noise to images | ||
iaa.Sometimes(frequency_factor, iaa.CoarseDropout((0.0, dropout_factor), size_percent=( | ||
0.08, 0.2), per_channel=color_factor)), | ||
# randomly remove up to X% of the pixels | ||
iaa.Sometimes(frequency_factor, iaa.Dropout((0.0, dropout_factor), per_channel=color_factor)), | ||
# randomly remove up to X% of the pixels | ||
iaa.Sometimes(frequency_factor, | ||
iaa.Add((-add_factor, add_factor), per_channel=color_factor)), | ||
# change brightness of images (by -X to Y of original value) | ||
iaa.Sometimes(frequency_factor, | ||
iaa.Multiply((multiply_factor_neg, multiply_factor_pos), per_channel=color_factor)), | ||
# change brightness of images (X-Y% of original value) | ||
# iaa.Sometimes(frequency_factor, iaa.ContrastNormalization((contrast_factor_neg, contrast_factor_pos), | ||
# per_channel=color_factor)), | ||
iaa.Sometimes(frequency_factor, iaa.contrast.LinearContrast((contrast_factor_neg, contrast_factor_pos), | ||
per_channel=color_factor)), | ||
# improve or worsen the contrast | ||
iaa.Sometimes(frequency_factor, iaa.Grayscale((0.0, 1))), # put grayscale | ||
|
||
], | ||
random_order=True # do all of the above in random order | ||
) | ||
|
||
return augmenter | ||
|
||
|
||
def hard_1(image_iteration): | ||
|
||
iteration = image_iteration/32 | ||
frequency_factor = min(0.05 + float(iteration)/200000.0, 1.0) | ||
color_factor = min(float(iteration)/1000000.0, 1.0) | ||
dropout_factor = 0.198667 + (0.03856658 - 0.198667) / (1 + (iteration / 196416.6) ** 1.863486) | ||
|
||
blur_factor = min(0.5 + (0.5*iteration/100000.0), 1.0) | ||
|
||
add_factor = 10 + 10*iteration/100000.0 | ||
|
||
multiply_factor_pos = 1 + (2.5*iteration/200000.0) | ||
multiply_factor_neg = 1 - (0.91 * iteration / 500000.0) | ||
|
||
contrast_factor_pos = 1 + (0.5*iteration/500000.0) | ||
contrast_factor_neg = 1 - (0.5 * iteration / 500000.0) | ||
|
||
augmenter = iaa.Sequential([ | ||
|
||
iaa.Sometimes(frequency_factor, iaa.GaussianBlur((0, blur_factor))), | ||
# blur images with a sigma between 0 and 1.5 | ||
iaa.Sometimes(frequency_factor, iaa.AdditiveGaussianNoise(loc=0, scale=(0.0, dropout_factor), | ||
per_channel=color_factor)), | ||
# add gaussian noise to images | ||
iaa.Sometimes(frequency_factor, iaa.CoarseDropout((0.0, dropout_factor), size_percent=( | ||
0.02, 0.2), per_channel=color_factor)), | ||
# randomly remove up to X% of the pixels | ||
iaa.Sometimes(frequency_factor, iaa.Dropout((0.0, dropout_factor), per_channel=color_factor)), | ||
# randomly remove up to X% of the pixels | ||
iaa.Sometimes(frequency_factor, | ||
iaa.Add((-add_factor, add_factor), per_channel=color_factor)), | ||
# change brightness of images (by -X to Y of original value) | ||
iaa.Sometimes(frequency_factor, | ||
iaa.Multiply((multiply_factor_neg, multiply_factor_pos), per_channel=color_factor)), | ||
# change brightness of images (X-Y% of original value) | ||
# iaa.Sometimes(frequency_factor, iaa.ContrastNormalization((contrast_factor_neg, contrast_factor_pos), | ||
# per_channel=color_factor)), | ||
iaa.Sometimes(frequency_factor, iaa.contrast.LinearContrast((contrast_factor_neg, contrast_factor_pos), | ||
per_channel=color_factor)), | ||
# improve or worsen the contrast | ||
iaa.Sometimes(frequency_factor, iaa.Grayscale((0.0, 1))), # put grayscale | ||
|
||
], | ||
random_order=True # do all of the above in random order | ||
) | ||
|
||
return augmenter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import os | ||
|
||
class GlobalConfig: | ||
""" base architecture configurations """ | ||
# Data | ||
seq_len = 1 # input timesteps | ||
pred_len = 4 # future waypoints predicted | ||
|
||
# data root for pretrain | ||
# root_dir_all = "tcp_carla_data" | ||
# data root for training | ||
root_dir_all = "/workspace/dataset/carla_data/" | ||
|
||
train_towns = ['train_data'] | ||
val_towns = ['val_data'] | ||
train_data, val_data = [], [] | ||
for town in train_towns: | ||
train_data.append(os.path.join(root_dir_all, town)) | ||
# train_data.append(os.path.join(root_dir_all, town+'_addition')) | ||
for town in val_towns: | ||
val_data.append(os.path.join(root_dir_all, town)) | ||
|
||
ignore_sides = True # don't consider side cameras | ||
ignore_rear = True # don't consider rear cameras | ||
|
||
input_resolution = 256 | ||
|
||
scale = 1 # image pre-processing | ||
crop = 256 # image pre-processing | ||
|
||
lr = 1e-4 # learning rate | ||
|
||
# Controller | ||
turn_KP = 0.75 | ||
turn_KI = 0.75 | ||
turn_KD = 0.3 | ||
turn_n = 40 # buffer size | ||
|
||
speed_KP = 5.0 | ||
speed_KI = 0.5 | ||
speed_KD = 1.0 | ||
speed_n = 40 # buffer size | ||
|
||
max_throttle = 0.75 # upper limit on throttle signal value in dataset | ||
brake_speed = 0.4 # desired speed below which brake is triggered | ||
brake_ratio = 1.1 # ratio of speed to desired speed at which brake is triggered | ||
clip_delta = 0.25 # maximum change in speed input to logitudinal controller | ||
|
||
|
||
aim_dist = 4.0 # distance to search around for aim point | ||
angle_thresh = 0.3 # outlier control detection angle | ||
dist_thresh = 10 # target point y-distance for outlier filtering | ||
|
||
|
||
speed_weight = 0.05 | ||
value_weight = 0.001 | ||
features_weight = 0.05 | ||
bev_weight = 1.0 | ||
graph_weight = 1.0 | ||
|
||
rl_ckpt = "/workspace/published_project/polar_BEV/roach/log/ckpt_11833344.pth" | ||
|
||
img_aug = True | ||
|
||
|
||
def __init__(self, **kwargs): | ||
for k,v in kwargs.items(): | ||
setattr(self, k, v) |
Oops, something went wrong.