Apollo 11.0
自动驾驶开放平台
classify.h
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2018 The Apollo Authors. All Rights Reserved.
3 *
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
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
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.
15 *****************************************************************************/
16#pragma once
17
18#include <map>
19#include <memory>
20#include <string>
21#include <vector>
22
28#include "modules/perception/traffic_light_recognition/recognition/caffe_recognizer/proto/model_param.pb.h"
29
30namespace apollo {
31namespace perception {
32namespace trafficlight {
33
35public:
40 ClassifyBySimple() = default;
45 ~ClassifyBySimple() = default;
52 void Init(const ClassifyParam& model_config, const int gpu_id);
59 void Perform(const camera::TrafficLightFrame* frame, std::vector<base::TrafficLightPtr>* lights);
60
61private:
62 void Prob2Color(const float* out_put_data, float threshold, base::TrafficLightPtr light);
63
64 std::shared_ptr<inference::Inference> rt_net_ = nullptr;
65 camera::DataProvider::ImageOptions data_provider_image_option_;
66 std::shared_ptr<base::Image8U> image_ = nullptr;
67 std::shared_ptr<base::Blob<float>> mean_buffer_;
68 std::shared_ptr<base::Blob<float>> mean_;
69 std::vector<std::string> net_inputs_;
70 std::vector<std::string> net_outputs_;
71 int resize_width_;
72 int resize_height_;
73 float unknown_threshold_;
74 float scale_;
75 int gpu_id_ = 0;
76};
77
78} // namespace trafficlight
79} // namespace perception
80} // namespace apollo
~ClassifyBySimple()=default
Destroy the new classify by simple object.
void Init(const ClassifyParam &model_config, const int gpu_id)
Initialize traffic light classify parameters.
Definition classify.cc:31
ClassifyBySimple()=default
Construct a new classify by simple object.
void Perform(const camera::TrafficLightFrame *frame, std::vector< base::TrafficLightPtr > *lights)
Classify model inference process.
Definition classify.cc:99
std::shared_ptr< TrafficLight > TrafficLightPtr
class register implement
Definition arena_queue.h:37