1 // This file is part of OpenCV project. 2 // It is subject to the license terms in the LICENSE file found in the top-level directory 3 // of this distribution and at http://opencv.org/license.html. 4 // 5 // Copyright (C) 2018, Intel Corporation, all rights reserved. 6 // Third party copyrights are property of their respective owners. 7 8 #ifndef OPENCV_DNN_VKCOM_OP_PRIOR_BOX_HPP 9 #define OPENCV_DNN_VKCOM_OP_PRIOR_BOX_HPP 10 11 #include "vkcom.hpp" 12 #include "op_base.hpp" 13 14 namespace cv { namespace dnn { namespace vkcom { 15 16 #ifdef HAVE_VULKAN 17 18 class OpPriorBox: public OpBase 19 { 20 public: 21 OpPriorBox(float step_x, 22 float step_y, 23 bool clip, 24 int num_priors, 25 std::vector<float>& variance, 26 std::vector<float>& offsets_x, 27 std::vector<float>& offsets_y, 28 std::vector<float>& box_widths, 29 std::vector<float>& box_heights); 30 bool forward(std::vector<Tensor>& in, Tensor& out); 31 void reshapeOutTensor(std::vector<Tensor *>& in, Tensor& out); 32 virtual bool forward(std::vector<Tensor>& ins, 33 std::vector<Tensor>& blobs, 34 std::vector<Tensor>& outs) CV_OVERRIDE; 35 private: 36 bool computeGroupCount(); 37 38 int global_size_; 39 int nthreads_; 40 float step_x_; 41 float step_y_; 42 bool clip_; 43 int num_priors_; 44 std::vector<float> variance_; 45 std::vector<float> offsets_x_; 46 std::vector<float> offsets_y_; 47 std::vector<float> box_widths_; 48 std::vector<float> box_heights_; 49 int img_h_; 50 int img_w_; 51 int in_h_; 52 int in_w_; 53 int out_channel_; 54 int out_channel_size_; 55 Tensor tensor_offsets_x_; 56 Tensor tensor_offsets_y_; 57 Tensor tensor_widths_; 58 Tensor tensor_heights_; 59 Tensor tensor_variance_; 60 }; 61 62 #endif // HAVE_VULKAN 63 64 }}} // namespace cv::dnn::vkcom 65 66 #endif // OPENCV_DNN_VKCOM_OP_PRIOR_BOX_HPP 67