Beispiel #1
0
 def test_caffe_same_name_layer(self):
     proto = caffe_pb2.NetParameter()
     text_format.Merge(proto_str_multi_input + proto_same_name_layers, proto)
     graph = Graph()
     caffe_pb_to_nx(graph, proto, None)
     # 6 nodes because: 2 inputs + 2 convolutions + 2 identity nodes used as fake outputs
     np.testing.assert_equal(len(graph.nodes()), 6)
Beispiel #2
0
    def test_caffe_pb_to_nx_one_input(self):
        proto = caffe_pb2.NetParameter()
        text_format.Merge(proto_str_one_input, proto)
        input_shapes = caffe_pb_to_nx(Graph(), proto, None)
        expected_input_shapes = {'Input0': np.array([1, 3, 224, 224])}

        for i in expected_input_shapes:
            np.testing.assert_array_equal(input_shapes[i],
                                          expected_input_shapes[i])
Beispiel #3
0
    def test_caffe_pb_to_multi_input(self):
        proto = caffe_pb2.NetParameter()
        text_format.Merge(proto_str_multi_input + layer_proto_str, proto)
        input_shapes = caffe_pb_to_nx(Graph(), proto, None)
        expected_input_shapes = {
            'data': np.array([1, 3, 224, 224]),
            'data1': np.array([1, 3])
        }

        for i in expected_input_shapes:
            np.testing.assert_array_equal(input_shapes[i], expected_input_shapes[i])
Beispiel #4
0
 def test_caffe_pb_to_nx_old_styled_multi_input(self):
     proto = caffe_pb2.NetParameter()
     text_format.Merge(proto_str_old_styled_multi_input + layer_proto_str,
                       proto)
     self.assertRaises(Error, caffe_pb_to_nx, Graph(), proto, None)