2 // Copyright (c) 2017 Intel Corporation
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
17 ///////////////////////////////////////////////////////////////////////////////////////////////////
19 #include "api/CPP/proposal.hpp"
20 #include "primitive_inst.h"
26 struct typed_program_node<proposal> : public typed_program_node_base<proposal>
28 using parent = typed_program_node_base<proposal>;
31 decltype(auto) cls_score() const { return get_dependency(0); }
32 decltype(auto) bbox_pred() const { return get_dependency(1); }
33 decltype(auto) image_info() const { return get_dependency(2); }
36 using proposal_node = typed_program_node<proposal>;
39 class typed_primitive_inst<proposal> : public typed_primitive_inst_base<proposal>
41 using parent = typed_primitive_inst_base<proposal>;
53 start_x = start_y = end_x = end_y = 0.0f;
56 anchor(float s_x, float s_y, float e_x, float e_y)
65 // indices of the memory objects used by the layer
72 //TODO(ruv): missign validation?? for image_info dimensions? also faster r-cnn expected it to be dim3 while the new networks expect dim 6!!! ([5] being unused)
73 //TODO(ruv): we should be able to set dims[3]=dim[4]=1 if not provided
75 // indices of the image info parameters inside the image_info memory object (the object
76 // is an integer array of these parameters)
77 enum image_info_size_index {
78 image_info_height_index,
79 image_info_width_index,
80 image_info_depth_index,
81 image_info_scale_min_bbox_y,
82 image_info_scale_min_bbox_x,
83 image_info_scale_depth_index,
86 static layout calc_output_layout(proposal_node const& node);
87 static std::string to_string(proposal_node const& node);
90 typed_primitive_inst(network_impl& network, proposal_node const& desc);
92 const std::vector<anchor>& get_anchors() const { return _anchors; }
95 std::vector<anchor> _anchors;
98 using proposal_inst = typed_primitive_inst<proposal>;