Skip to content

Commit 384896e

Browse files
committed
add ssd model
1 parent 9ddd45a commit 384896e

File tree

9 files changed

+316
-86
lines changed

9 files changed

+316
-86
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,4 @@
55
output
66
training
77
*.record
8-
model
98
inference_graph/

config/fyp.config

Lines changed: 133 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -1,130 +1,178 @@
11
model {
2-
faster_rcnn {
2+
ssd {
33
num_classes: 1
44
image_resizer {
5-
keep_aspect_ratio_resizer {
6-
# Raw KITTI images have a resolution of 1242x375, if we wish to resize
7-
# them to have a height of 600 then their width should be
8-
# 1242/(375/600)=1987.2
9-
min_dimension: 600
10-
max_dimension: 1987
5+
fixed_shape_resizer {
6+
height: 300
7+
width: 300
118
}
129
}
1310
feature_extractor {
14-
type: 'faster_rcnn_resnet101'
15-
first_stage_features_stride: 16
11+
type: "ssd_mobilenet_v2"
12+
depth_multiplier: 1.0
13+
min_depth: 16
14+
conv_hyperparams {
15+
regularizer {
16+
l2_regularizer {
17+
weight: 3.99999989895e-05
18+
}
19+
}
20+
initializer {
21+
truncated_normal_initializer {
22+
mean: 0.0
23+
stddev: 0.0299999993294
24+
}
25+
}
26+
activation: RELU_6
27+
batch_norm {
28+
decay: 0.999700009823
29+
center: true
30+
scale: true
31+
epsilon: 0.0010000000475
32+
train: true
33+
}
34+
}
1635
}
17-
first_stage_anchor_generator {
18-
grid_anchor_generator {
19-
scales: [0.25, 0.5, 1.0, 2.0]
20-
aspect_ratios: [0.5, 1.0, 2.0]
21-
height_stride: 16
22-
width_stride: 16
36+
box_coder {
37+
faster_rcnn_box_coder {
38+
y_scale: 10.0
39+
x_scale: 10.0
40+
height_scale: 5.0
41+
width_scale: 5.0
2342
}
2443
}
25-
first_stage_box_predictor_conv_hyperparams {
26-
op: CONV
27-
regularizer {
28-
l2_regularizer {
29-
weight: 0.0
30-
}
44+
matcher {
45+
argmax_matcher {
46+
matched_threshold: 0.5
47+
unmatched_threshold: 0.5
48+
ignore_thresholds: false
49+
negatives_lower_than_unmatched: true
50+
force_match_for_each_row: true
3151
}
32-
initializer {
33-
truncated_normal_initializer {
34-
stddev: 0.01
35-
}
52+
}
53+
similarity_calculator {
54+
iou_similarity {
3655
}
3756
}
38-
first_stage_nms_score_threshold: 0.0
39-
first_stage_nms_iou_threshold: 0.7
40-
first_stage_max_proposals: 300
41-
first_stage_localization_loss_weight: 2.0
42-
first_stage_objectness_loss_weight: 1.0
43-
initial_crop_size: 14
44-
maxpool_kernel_size: 2
45-
maxpool_stride: 2
46-
second_stage_box_predictor {
47-
mask_rcnn_box_predictor {
48-
use_dropout: false
49-
dropout_keep_probability: 1.0
50-
fc_hyperparams {
51-
op: FC
57+
box_predictor {
58+
convolutional_box_predictor {
59+
conv_hyperparams {
5260
regularizer {
5361
l2_regularizer {
54-
weight: 0.0
62+
weight: 3.99999989895e-05
5563
}
5664
}
5765
initializer {
58-
variance_scaling_initializer {
59-
factor: 1.0
60-
uniform: true
61-
mode: FAN_AVG
66+
truncated_normal_initializer {
67+
mean: 0.0
68+
stddev: 0.0299999993294
6269
}
6370
}
71+
activation: RELU_6
72+
batch_norm {
73+
decay: 0.999700009823
74+
center: true
75+
scale: true
76+
epsilon: 0.0010000000475
77+
train: true
78+
}
6479
}
80+
min_depth: 0
81+
max_depth: 0
82+
num_layers_before_predictor: 0
83+
use_dropout: false
84+
dropout_keep_probability: 0.800000011921
85+
kernel_size: 1
86+
box_code_size: 4
87+
apply_sigmoid_to_scores: false
6588
}
6689
}
67-
second_stage_post_processing {
90+
anchor_generator {
91+
ssd_anchor_generator {
92+
num_layers: 6
93+
min_scale: 0.20000000298
94+
max_scale: 0.949999988079
95+
aspect_ratios: 1.0
96+
aspect_ratios: 2.0
97+
aspect_ratios: 0.5
98+
aspect_ratios: 3.0
99+
aspect_ratios: 0.333299994469
100+
}
101+
}
102+
post_processing {
68103
batch_non_max_suppression {
69-
score_threshold: 0.0
70-
iou_threshold: 0.6
104+
score_threshold: 9.99999993923e-09
105+
iou_threshold: 0.649999976158
71106
max_detections_per_class: 100
72-
max_total_detections: 300
107+
max_total_detections: 100
73108
}
74-
score_converter: SOFTMAX
109+
score_converter: SIGMOID
75110
}
76-
second_stage_localization_loss_weight: 2.0
77-
second_stage_classification_loss_weight: 1.0
78-
}
79-
}
80-
81-
train_config: {
82-
batch_size: 8
83-
optimizer {
84-
momentum_optimizer: {
85-
learning_rate: {
86-
manual_step_learning_rate {
87-
initial_learning_rate: 0.005
88-
schedule {
89-
step: 500000
90-
learning_rate: .00001
91-
}
92-
schedule {
93-
step: 700000
94-
learning_rate: .000001
95-
}
111+
normalize_loss_by_num_matches: true
112+
loss {
113+
localization_loss {
114+
weighted_smooth_l1 {
115+
}
116+
}
117+
classification_loss {
118+
weighted_sigmoid {
96119
}
97120
}
98-
momentum_optimizer_value: 0.9
121+
hard_example_miner {
122+
num_hard_examples: 3000
123+
iou_threshold: 0.990000009537
124+
loss_type: CLASSIFICATION
125+
max_negatives_per_positive: 3
126+
min_negatives_per_image: 3
127+
}
128+
classification_weight: 1.0
129+
localization_weight: 1.0
99130
}
100-
use_moving_average: false
101131
}
102-
gradient_clipping_by_norm: 10.0
103-
fine_tune_checkpoint: "brain/model/model.ckpt"
104-
from_detection_checkpoint: true
105-
num_steps: 800000
132+
}
133+
train_config {
134+
batch_size: 128
106135
data_augmentation_options {
107136
random_horizontal_flip {
108137
}
109138
}
139+
data_augmentation_options {
140+
ssd_random_crop {
141+
}
142+
}
143+
optimizer {
144+
rms_prop_optimizer {
145+
learning_rate {
146+
exponential_decay_learning_rate {
147+
initial_learning_rate: 0.01
148+
decay_steps: 800720
149+
decay_factor: 0.949999988079
150+
}
151+
}
152+
momentum_optimizer_value: 0.899999976158
153+
decay: 0.899999976158
154+
epsilon: 1.0
155+
}
156+
}
157+
fine_tune_checkpoint: "brain/preTrianedModel/model.ckpt"
158+
fine_tune_checkpoint_type: "detection"
110159
}
111-
112-
train_input_reader: {
160+
train_input_reader {
113161
label_map_path: "brain/config/labels.pbtxt"
114-
tf_record_input_reader: {
162+
tf_record_input_reader {
115163
input_path: "brain/config/train.record"
116164
}
117165
}
118-
119-
eval_config: {
166+
eval_config {
167+
num_visualizations: 20
168+
num_examples: 20
120169
use_moving_averages: false
121-
num_examples: 10
122-
num_visualizations: 10
123170
}
124-
125-
eval_input_reader: {
171+
eval_input_reader {
126172
label_map_path: "brain/config/labels.pbtxt"
127-
tf_record_input_reader: {
173+
shuffle: false
174+
num_readers: 1
175+
tf_record_input_reader {
128176
input_path: "brain/config/test.record"
129177
}
130178
}

model/checkpoint

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
model_checkpoint_path: "model.ckpt"
2+
all_model_checkpoint_paths: "model.ckpt"

model/frozen_inference_graph.pb

19 MB
Binary file not shown.
17.4 MB
Binary file not shown.

model/model.ckpt.index

17.3 KB
Binary file not shown.

model/model.ckpt.meta

3.5 MB
Binary file not shown.

0 commit comments

Comments
 (0)