Skip to content

Commit 3a431b7

Browse files
committed
Towards a bigger C3D
1 parent b8d6a5a commit 3a431b7

16 files changed

Lines changed: 535 additions & 293 deletions
187 KB
Loading
187 KB
Loading
207 KB
Loading

code/autoencoder_model/scripts/classifier.py

Lines changed: 151 additions & 56 deletions
Large diffs are not rendered by default.

code/autoencoder_model/scripts/config_classifier.py

Lines changed: 35 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,16 @@
7979
# KL coeff damages learning
8080
KL_COEFF = 0
8181
CLASSIFIER = True
82-
BUF_SIZE = 10
83-
LOSS_WEIGHTS = [1, 1]
84-
A_TRAIN_RATIO = 1
85-
C_TRAIN_RATIO = 1
86-
87-
ped_actions = ['slow down', 'standing', 'moving fast', 'speed up', 'look', 'nod', 'unknown', 'moving slow',
88-
'flasher signal', 'looking' , 'handwave', 'clear path', 'stopped', 'slowing down',
89-
'crossing', 'speeding up']
82+
RAM_DECIMATE = True
83+
RETRAIN_CLASSIFIER = True
84+
CLASS_TARGET_INDEX = 24
85+
86+
ped_actions = ['slow down', 'moving slow', 'standing', 'stopped',
87+
'speed up', 'moving fast', 'look', 'looking', 'clear path',
88+
'crossing', 'nod', 'handwave', 'unknown']
89+
90+
simple_ped_set = ['crossing', 'stopped', 'looking', 'clear path', 'unknown']
91+
9092
driver_actions = ['moving slow', 'slowing down', 'standing', 'speeding up', 'moving fast']
9193
simple_driver_set = ['slow down', 'stop', 'speed up']
9294

@@ -107,22 +109,32 @@
107109
print ("Loading network/training configuration...")
108110
print ("Config file: " + str(__name__))
109111

110-
BATCH_SIZE = 10
112+
BATCH_SIZE = 25
111113
NB_EPOCHS_AUTOENCODER = 0
112114
NB_EPOCHS_CLASS = 100
113115

114116
OPTIM_A = Adam(lr=0.0001, beta_1=0.5)
115-
OPTIM_G = Adam(lr=0.0001, beta_1=0.5)
116-
OPTIM_D = Adam(lr=0.000001, beta_1=0.5)
117-
OPTIM_C = Adam(lr=0.0001, beta_1=0.5)
118-
119-
lr_schedule = [10, 20, 30] # epoch_step
120-
121-
def schedule(epoch_idx):
122-
if (epoch_idx + 1) < lr_schedule[0]:
123-
return 0.00000002
124-
elif (epoch_idx + 1) < lr_schedule[1]:
125-
return 0.000000002 # lr_decay_ratio = 10
126-
elif (epoch_idx + 1) < lr_schedule[2]:
127-
return 0.0000000002
128-
return 0.0000000002
117+
# OPTIM_C = Adam(lr=0.0000002, beta_1=0.5)
118+
OPTIM_C = SGD(lr=0.0001, momentum=0.9, nesterov=True)
119+
120+
121+
auto_lr_schedule = [25, 30, 35] # epoch_step
122+
def auto_schedule(epoch_idx):
123+
if (epoch_idx + 1) < auto_lr_schedule[0]:
124+
return 0.0001
125+
elif (epoch_idx + 1) < auto_lr_schedule[1]:
126+
return 0.00001 # lr_decay_ratio = 10
127+
elif (epoch_idx + 1) < auto_lr_schedule[2]:
128+
return 0.00001
129+
return 0.00001
130+
131+
132+
clas_lr_schedule = [50, 55, 60] # epoch_step
133+
def clas_schedule(epoch_idx):
134+
if (epoch_idx + 1) < clas_lr_schedule[0]:
135+
return 0.0001
136+
elif (epoch_idx + 1) < clas_lr_schedule[1]:
137+
return 0.00001 # lr_decay_ratio = 10
138+
elif (epoch_idx + 1) < clas_lr_schedule[2]:
139+
return 0.000001
140+
return 0.000001

code/autoencoder_model/scripts/config_oc.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,9 @@
8383
LOSS_WEIGHTS = [1, 1]
8484
A_TRAIN_RATIO = 1
8585
C_TRAIN_RATIO = 1
86-
RAM_DECIMATE = True
86+
RAM_DECIMATE = False
87+
RETRAIN_CLASSIFIER = True
88+
CLASS_TARGET_INDEX = 8
8789

8890
ped_actions = ['slow down', 'moving slow', 'standing', 'stopped',
8991
'speed up', 'moving fast', 'look', 'looking', 'clear path',
@@ -129,16 +131,7 @@
129131
# OPTIM_C = Adam(lr=0.0000002, beta_1=0.5)
130132
OPTIM_C = SGD(lr=0.0001, momentum=0.9, nesterov=True)
131133

132-
lr_schedule = [5, 10, 15] # epoch_step
133-
134-
# def schedule(epoch_idx):
135-
# if (epoch_idx + 1) < lr_schedule[0]:
136-
# return 0.0000001
137-
# elif (epoch_idx + 1) < lr_schedule[1]:
138-
# return 0.000000001 # lr_decay_ratio = 10
139-
# elif (epoch_idx + 1) < lr_schedule[2]:
140-
# return 0.0000000001
141-
# return 0.0000000001
134+
lr_schedule = [50, 55, 60] # epoch_step
142135

143136
def schedule(epoch_idx):
144137
if (epoch_idx + 1) < lr_schedule[0]:
@@ -147,4 +140,13 @@ def schedule(epoch_idx):
147140
return 0.00001 # lr_decay_ratio = 10
148141
elif (epoch_idx + 1) < lr_schedule[2]:
149142
return 0.000001
150-
return 0.000001
143+
return 0.000001
144+
145+
# def schedule(epoch_idx):
146+
# if (epoch_idx + 1) < lr_schedule[0]:
147+
# return 0.000001
148+
# elif (epoch_idx + 1) < lr_schedule[1]:
149+
# return 0.0000001 # lr_decay_ratio = 10
150+
# elif (epoch_idx + 1) < lr_schedule[2]:
151+
# return 0.00000001
152+
# return 0.00000001

code/autoencoder_model/scripts/gifimages.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ def strip(image, img_size, vid_len, vid_num=1):
2424
for i in range(n_vertical_imgs):
2525
for j in range(n_horizontal_imgs):
2626
img = image[i*img_size:(i+1)*img_size, j*img_size:(j+1)*img_size]
27-
if (j>=10):
28-
# img = cv2.blur(img, (5, 5), 0)
29-
img = cv2.medianBlur(img, 7)
30-
# img = cv2.bilateralFilter(img, 9, 150, 25)
31-
img = cv2.cvtColor(img, cv2.COLOR_BGR2HSV) # convert it to hsv
32-
img[:, :, 2] -= 2
33-
img = cv2.cvtColor(img, cv2.COLOR_HSV2BGR)
27+
# if (j>=10):
28+
# # img = cv2.blur(img, (5, 5), 0)
29+
# img = cv2.medianBlur(img, 7)
30+
# # img = cv2.bilateralFilter(img, 9, 150, 25)
31+
# img = cv2.cvtColor(img, cv2.COLOR_BGR2HSV) # convert it to hsv
32+
# img[:, :, 2] -= 2
33+
# img = cv2.cvtColor(img, cv2.COLOR_HSV2BGR)
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))

0 commit comments

Comments
 (0)