Skip to content

Commit 159c35d

Browse files
committed
update
1 parent 104a20f commit 159c35d

File tree

5 files changed

+37
-9
lines changed

5 files changed

+37
-9
lines changed

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,4 +128,9 @@ dmypy.json
128128
*.txt
129129
/object_detection/test_ckpt/
130130
/object_detection/test_data/
131-
/object_detection/test_images/
131+
/object_detection/test_images/
132+
*.meta
133+
*.index
134+
model_file/pretrain/checkpoint
135+
*.pb
136+
*.data-00000-of-00001

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@
1111
- Tensorflow 1.15.2
1212
- lxml 4.5.0
1313
- Pillow 7.0.0
14-
- Matplotlib 3.2.0
14+
- matplotlib 3.2.0
15+
- PyYaml 5.3

model_train.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import os
2+
import shutil
3+
import argparse
4+
import sys
5+
6+
parser = argparse.ArgumentParser()
7+
parser.add_argument("-path", help="Specify the absolute path to the compressed file")
8+
args = parser.parse_args()
9+
10+
if not hasattr(args, 'path'):
11+
print("Please specify the absolute path with \"-path\"")
12+
else:
13+
os.chdir(sys.path[0])
14+
15+
if len(os.listdir('model_file/pretrain')) > 1:
16+
pass
17+
else:
18+
shutil.copy(args.path, 'model_file/pretrain')
19+
os.system('pip install -e slim')
20+
os.system('python object_detection/legacy/train.py --train_dir=model_file/train ' +
21+
'--pipeline_config_path=ssd_resnet50_v1_fpn.config')

object_detection/legacy/train.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@
9191
@contrib_framework.deprecated(None, 'Use object_detection/model_main.py.')
9292
def main(_):
9393
assert FLAGS.train_dir, '`train_dir` is missing.'
94-
if FLAGS.task == 0: tf.gfile.MakeDirs(FLAGS.train_dir)
94+
if FLAGS.task == 0:
95+
tf.gfile.MakeDirs(FLAGS.train_dir)
9596
if FLAGS.pipeline_config_path:
9697
configs = config_util.get_configs_from_pipeline_file(
9798
FLAGS.pipeline_config_path)

ssd_resnet50_v1_fpn.config

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,13 +127,13 @@ model {
127127
}
128128

129129
train_config: {
130-
fine_tune_checkpoint:"/Users/widget/Documents/Projects.nosync/Python.nosyc/sonar_baseline_with_tensorflow/model_file/pretrain/model.ckpt"
130+
fine_tune_checkpoint:"model_file/pretrain/model.ckpt"
131131
from_detection_checkpoint: true
132132
batch_size: 16
133133
sync_replicas: true
134134
startup_delay_steps: 0
135135
replicas_to_aggregate: 8
136-
num_steps: 25000
136+
num_steps: 50000
137137
data_augmentation_options {
138138
random_horizontal_flip {
139139
}
@@ -168,9 +168,9 @@ from_detection_checkpoint: true
168168

169169
train_input_reader: {
170170
tf_record_input_reader {
171-
input_path:"/Users/widget/Documents/Projects.nosync/Python.nosyc/sonar_baseline_with_tensorflow/dataset/tfrecords/pascal_train.record"
171+
input_path:"dataset/tfrecords/pascal_train.record"
172172
}
173-
label_map_path:"/Users/widget/Documents/Projects.nosync/Python.nosyc/sonar_baseline_with_tensorflow/dataset/pascal_label_map.pbtxt"
173+
label_map_path:"dataset/pascal_label_map.pbtxt"
174174
}
175175

176176
eval_config: {
@@ -181,9 +181,9 @@ eval_config: {
181181

182182
eval_input_reader: {
183183
tf_record_input_reader {
184-
input_path:"/Users/widget/Documents/Projects.nosync/Python.nosyc/sonar_baseline_with_tensorflow/dataset/tfrecords/pascal_val.record"
184+
input_path:"dataset/tfrecords/pascal_val.record"
185185
}
186-
label_map_path:"/Users/widget/Documents/Projects.nosync/Python.nosyc/sonar_baseline_with_tensorflow/dataset/pascal_label_map.pbtxt"
186+
label_map_path:"dataset/pascal_label_map.pbtxt"
187187
shuffle: false
188188
num_readers: 1
189189
}

0 commit comments

Comments
 (0)