Skip to content

Commit 7253c09

Browse files
committed
Begin frame augmentation
1 parent f91390e commit 7253c09

10 files changed

Lines changed: 268 additions & 308 deletions

File tree

code/autoencoder_model/scripts/config_oc.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
LOSS_WEIGHTS = [1, 1]
8282
A_TRAIN_RATIO = 1
8383
C_TRAIN_RATIO = 1
84-
RAM_DECIMATE = False
84+
RAM_DECIMATE = True
8585
RETRAIN_CLASSIFIER = False
8686
CLASS_TARGET_INDEX = 8
8787

@@ -97,8 +97,8 @@
9797

9898
# simple_ped_set = ['crossing', 'stopped', 'looking', 'clear path', 'unknown']
9999

100-
# simple_ped_set = ['standing 0', 'approaching 1', 'looking 2', 'crossing 3', 'stopped 4', 'clear path 5', 'unknown 6', 'no ped 7']
101-
simple_ped_set = ['standing', 'approaching', 'looking', 'crossing', 'stopped', 'clear path', 'unknown', 'no ped']
100+
# simple_ped_set = ['standing 0', 'approaching 1', 'crossing 2', 'stopped 3', 'clear path 4', 'unknown 5', 'no ped 6']
101+
simple_ped_set = ['standing', 'approaching', 'crossing', 'stopped', 'clear path', 'unknown', 'no ped']
102102

103103

104104

@@ -125,11 +125,11 @@
125125
print ("Config file: " + str(__name__))
126126

127127
BATCH_SIZE = 25
128-
NB_EPOCHS_CLASS = 100
128+
NB_EPOCHS_CLASS = 15
129129

130130
# OPTIM_C = Adam(lr=0.0000002, beta_1=0.5)
131-
OPTIM_C = SGD(lr=0.0001, momentum=0.9, nesterov=True)
132-
# OPTIM_C = RMSprop(lr=0.0001, rho=0.9)
131+
# OPTIM_C = SGD(lr=0.0001, momentum=0.9, nesterov=True)
132+
OPTIM_C = RMSprop(lr=0.0001, rho=0.9)
133133

134134
# lr_schedule = [10, 20, 30] # epoch_step
135135

@@ -143,12 +143,12 @@
143143
# return 0.000000001
144144

145145

146-
lr_schedule = [5, 10, 15] # epoch_step
146+
lr_schedule = [4, 7, 10] # epoch_step
147147
def schedule(epoch_idx):
148148
if (epoch_idx + 1) < lr_schedule[0]:
149-
return 0.00001
149+
return 0.0001
150150
elif (epoch_idx + 1) < lr_schedule[1]:
151-
return 0.000001 # lr_decay_ratio = 10
151+
return 0.00001 # lr_decay_ratio = 10
152152
elif (epoch_idx + 1) < lr_schedule[2]:
153-
return 0.0000001
154-
return 0.0000001
153+
return 0.000001
154+
return 0.000001

code/autoencoder_model/scripts/config_r16.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
IMG_SIZE = (128, 208, 3)
7070
ATTN_COEFF = 0
7171
KL_COEFF = 0
72-
RAM_DECIMATE = True
72+
RAM_DECIMATE = False
7373
REVERSE = True
7474

7575
# -------------------------------------------------
@@ -78,7 +78,7 @@
7878
print ("Config file: " + str(__name__))
7979

8080
BATCH_SIZE = 10
81-
NB_EPOCHS_AUTOENCODER = 40
81+
NB_EPOCHS_AUTOENCODER = 30
8282

8383
OPTIM_A = Adam(lr=0.0001, beta_1=0.5)
8484
# OPTIM_A = SGD(lr=0.000001, momentum=0.5, nesterov=True)

code/autoencoder_model/scripts/gifimages.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def create_gif(filenames, duration, vid_num):
1111
imageio.mimsave(os.path.join(GIF_DIR, video_name), images, duration=duration)
1212

1313

14-
def strip(image, img_height, img_width, vid_len, vid_num=1):
14+
def strip(image, img_height, img_width, vid_len, vid_num=1, rev=False):
1515
n_rows = image.shape[0]
1616
n_cols = image.shape[1]
1717
n_horizontal_imgs = n_cols/img_width
@@ -34,8 +34,9 @@ def strip(image, img_height, img_width, vid_len, vid_num=1):
3434
filename = "vid_" + str(vid_num) + "_frame_" + str(frame_num) + ".png"
3535
cv2.imwrite(os.path.join(GIF_IMG_DIR, filename), img)
3636
filenames.append(os.path.join(GIF_IMG_DIR, filename))
37-
if frame_num == (int(vid_len/2)):
38-
filenames = list(reversed(filenames))
37+
if rev:
38+
if frame_num == (int(vid_len/2)):
39+
filenames = list(reversed(filenames))
3940
if frame_num == vid_len:
4041

4142
create_gif(filenames=filenames, duration=duration, vid_num=vid_num)
@@ -60,6 +61,7 @@ def get_args():
6061
parser.add_argument("--img_height", type=int, default=128)
6162
parser.add_argument("--img_width", type=int, default=128)
6263
parser.add_argument("--vid_len", type=int, default=10)
64+
parser.add_argument("--rev", type=bool, default=False)
6365
args = parser.parse_args()
6466
return args
6567

@@ -87,4 +89,4 @@ def get_args():
8789
except IOError as e:
8890
print (e)
8991

90-
strip(image=im, img_height=args.img_height, img_width=args.img_width, vid_len=args.vid_len)
92+
strip(image=im, img_height=args.img_height, img_width=args.img_width, vid_len=args.vid_len, rev=args.rev)

0 commit comments

Comments
 (0)