Apollo 11.0
自动驾驶开放平台
roipooling_layer.h
浏览该文件的文档.
1/******************************************************************************
2COPYRIGHT
3
4All contributions by the University of California:
5Copyright (c) 2014-2017 The Regents of the University of California (Regents)
6All rights reserved.
7
8All other contributions:
9Copyright (c) 2014-2017, the respective contributors
10All rights reserved.
11
12Caffe uses a shared copyright model: each contributor holds copyright over
13their contributions to Caffe. The project versioning records all such
14contribution and copyright details. If a contributor wants to further mark
15their specific copyright on a particular contribution, they should indicate
16their copyright solely in the commit message of the change when it is
17committed.
18
19LICENSE
20
21Redistribution and use in source and binary forms, with or without
22modification, are permitted provided that the following conditions are met:
23
241. Redistributions of source code must retain the above copyright notice, this
25 list of conditions and the following disclaimer.
262. Redistributions in binary form must reproduce the above copyright notice,
27 this list of conditions and the following disclaimer in the documentation
28 and/or other materials provided with the distribution.
29
30THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
31ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
32WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
33DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
34ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
35(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
36LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
37ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
38(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
39SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40
41CONTRIBUTION AGREEMENT
42
43By contributing to the BVLC/caffe repository through pull-request, comment,
44or otherwise, the contributor releases their content to the
45license and copyright terms herein.
46 *****************************************************************************/
47
48/******************************************************************************
49 * Copyright 2018 The Apollo Authors. All Rights Reserved.
50 *
51 * Licensed under the Apache License, Version 2.0 (the "License");
52 * you may not use this file except in compliance with the License.
53 * You may obtain a copy of the License at
54 *
55 * http://www.apache.org/licenses/LICENSE-2.0
56 *
57 * Unless required by applicable law or agreed to in writing, software
58 * distributed under the License is distributed on an "AS IS" BASIS,
59 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
60 * See the License for the specific language governing permissions and
61 * limitations under the License.
62 *****************************************************************************/
63
64#pragma once
65
66#include <limits>
67#include <memory>
68#include <vector>
69
71
72namespace apollo {
73namespace perception {
74namespace inference {
75
76template <typename Dtype>
77class ROIPoolingLayer : public Layer<Dtype> {
78 public:
79 ROIPoolingLayer(int pooled_h, int pooled_w, bool use_floor,
80 float spatial_scale, int channels, int max_objs = 1000)
81 : channels_(0),
82 height_(0),
83 width_(0),
84 pooled_height_(pooled_h),
85 pooled_width_(pooled_w),
86 use_floor_(use_floor),
87 float_max_(std::numeric_limits<float>::max()),
88 spatial_scale_(spatial_scale) {
89 max_idx_.Reshape(max_objs, channels, pooled_height_, pooled_width_);
90 }
91 void ForwardGPU(const std::vector<std::shared_ptr<base::Blob<Dtype>>> &bottom,
92 const std::vector<std::shared_ptr<base::Blob<Dtype>>> &top);
93 void ForwardCPU(const std::vector<std::shared_ptr<base::Blob<Dtype>>> &bottom,
94 const std::vector<std::shared_ptr<base::Blob<Dtype>>> &top);
95
96 private:
97 base::Blob<int> max_idx_;
98 int channels_;
99 int height_;
100 int width_;
101 int pooled_height_;
102 int pooled_width_;
103 bool use_floor_;
104 const float float_max_;
105 float spatial_scale_;
106};
107
108} // namespace inference
109} // namespace perception
110} // namespace apollo
A wrapper around SyncedMemory holders serving as the basic computational unit for images,...
Definition blob.h:88
void Reshape(const int num, const int channels, const int height, const int width)
Deprecated; use Reshape(const std::vector<int>& shape).
Definition blob.cc:72
void ForwardCPU(const std::vector< std::shared_ptr< base::Blob< Dtype > > > &bottom, const std::vector< std::shared_ptr< base::Blob< Dtype > > > &top)
void ForwardGPU(const std::vector< std::shared_ptr< base::Blob< Dtype > > > &bottom, const std::vector< std::shared_ptr< base::Blob< Dtype > > > &top)
ROIPoolingLayer(int pooled_h, int pooled_w, bool use_floor, float spatial_scale, int channels, int max_objs=1000)
class register implement
Definition arena_queue.h:37
Definition future.h:29