Skip to content

Commit a54bd6c

Browse files
committed
Merge remote-tracking branch 'upstream/3.4' into merge-3.4
2 parents aa307a7 + 8869985 commit a54bd6c

File tree

5 files changed

+40
-0
lines changed

5 files changed

+40
-0
lines changed

testdata/dnn/tensorflow/generate_tf_models.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -703,6 +703,27 @@ def pad_depth(x, desired_channels):
703703
f.write(graph_def.SerializeToString())
704704

705705
################################################################################
706+
# issue https://github.com/opencv/opencv/issues/13839
707+
inp_node = 'PNet/conv3/add'
708+
out_node = 'PNet/cls_prob'
709+
with tf.Session(graph=tf.Graph()) as localSession:
710+
localSession.graph.as_default()
711+
712+
with tf.gfile.FastGFile('PNet_pnet.pb') as f:
713+
graph_def = tf.GraphDef()
714+
graph_def.ParseFromString(f.read())
715+
graph_def = TransformGraph(graph_def, [inp_node], [out_node], ['strip_unused_nodes'])
716+
717+
tf.import_graph_def(graph_def, name='')
718+
719+
inputData = gen_data(tf.placeholder(tf.float32, [1, 4, 5, 16], inp_node))
720+
outputData = localSession.run(localSession.graph.get_tensor_by_name(out_node + ':0'),
721+
feed_dict={inp_node + ':0': inputData})
722+
writeBlob(inputData, 'slim_softmax_v2_in')
723+
writeBlob(outputData, 'slim_softmax_v2_out')
724+
725+
with tf.gfile.FastGFile('slim_softmax_v2_net.pb', 'wb') as f:
726+
f.write(graph_def.SerializeToString())
706727

707728
# Uncomment to print the final graph.
708729
# with tf.gfile.FastGFile('fused_batch_norm_net.pb') as f:
1.33 KB
Binary file not shown.
2.09 KB
Binary file not shown.
240 Bytes
Binary file not shown.

testdata/ml/opencv_ml_knn.xml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0"?>
2+
<opencv_storage>
3+
<opencv_ml_knn>
4+
<format>3</format>
5+
<is_classifier>1</is_classifier>
6+
<default_k>10</default_k>
7+
<samples type_id="opencv-matrix">
8+
<rows>3</rows>
9+
<cols>2</cols>
10+
<dt>f</dt>
11+
<data>
12+
1. 1. 3. 3. 10. 5.</data></samples>
13+
<responses type_id="opencv-matrix">
14+
<rows>3</rows>
15+
<cols>1</cols>
16+
<dt>f</dt>
17+
<data>
18+
0. 1. 2.</data></responses></opencv_ml_knn>
19+
</opencv_storage>

0 commit comments

Comments
 (0)