Skip to content

Commit 9483caf

Browse files
authored
Merge pull request hunglc007#61 from wooruang/master
Modify some codes to use own train weights for the detect scripts
2 parents fbb7b42 + 881f7f7 commit 9483caf

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

detect.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,11 @@ def main(_argv):
6565
bbox_tensor = decode(fm, NUM_CLASS, i)
6666
bbox_tensors.append(bbox_tensor)
6767
model = tf.keras.Model(input_layer, bbox_tensors)
68-
utils.load_weights(model, FLAGS.weights)
68+
69+
if FLAGS.weights.split(".")[len(FLAGS.weights.split(".")) - 1] == "weights":
70+
utils.load_weights(model, FLAGS.weights)
71+
else:
72+
model.load_weights(FLAGS.weights).expect_partial()
6973

7074
model.summary()
7175
pred_bbox = model.predict(image_data)

detectvideo.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,11 @@ def main(_argv):
6161
bbox_tensor = decode(fm, NUM_CLASS, i)
6262
bbox_tensors.append(bbox_tensor)
6363
model = tf.keras.Model(input_layer, bbox_tensors)
64-
utils.load_weights(model, FLAGS.weights)
64+
65+
if FLAGS.weights.split(".")[len(FLAGS.weights.split(".")) - 1] == "weights":
66+
utils.load_weights(model, FLAGS.weights)
67+
else:
68+
model.load_weights(FLAGS.weights).expect_partial()
6569

6670
model.summary()
6771
else:

0 commit comments

Comments
 (0)