提交 9e33ae6f 编写于 作者: C Calvin Miao 提交者: Jiangtao Hu

Perception: fixed misusing of logging

上级 d95857ff
...@@ -45,6 +45,7 @@ cc_library( ...@@ -45,6 +45,7 @@ cc_library(
"blob.h", "blob.h",
], ],
deps = [ deps = [
"//cybertron",
":common", ":common",
":syncedmem", ":syncedmem",
], ],
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "glog/logging.h" #include "cybertron/common/log.h"
#include "modules/perception/base/syncedmem.h" #include "modules/perception/base/syncedmem.h"
namespace apollo { namespace apollo {
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#include <cstdlib> #include <cstdlib>
#include <iostream> #include <iostream>
#include "glog/logging.h" #include "cybertron/common/log.h"
#include "modules/perception/base/common.h" #include "modules/perception/base/common.h"
namespace apollo { namespace apollo {
......
/****************************************************************************** /******************************************************************************
* Copyright 2018 The Apollo Authors. All Rights Reserved. * Copyright 2018 The Apollo Authors. All Rights Reserved.
* *
* Licensed under the Apache License, Version 2.0 (the License); * Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, * distributed under the License is distributed on an AS IS BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*****************************************************************************/ *****************************************************************************/
#pragma once #pragma once
#include <fcntl.h>
#include <cblas.h>
#include <google/protobuf/io/coded_stream.h> #include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/io/zero_copy_stream_impl.h>
#include <google/protobuf/io/gzip_stream.h> #include <google/protobuf/io/gzip_stream.h>
#include <google/protobuf/io/zero_copy_stream_impl.h>
#include <google/protobuf/text_format.h> #include <google/protobuf/text_format.h>
#include <cblas.h>
#include <algorithm> #include <algorithm>
#include <fstream> #include <fstream>
#include <iostream> #include <iostream>
...@@ -29,7 +28,8 @@ ...@@ -29,7 +28,8 @@
#include <numeric> #include <numeric>
#include <string> #include <string>
#include <vector> #include <vector>
#include "glog/logging.h"
#include "cybertron/common/log.h"
#include "modules/perception/base/blob.h" #include "modules/perception/base/blob.h"
#include "modules/perception/base/image.h" #include "modules/perception/base/image.h"
#include "modules/perception/base/object.h" #include "modules/perception/base/object.h"
...@@ -43,16 +43,14 @@ bool Equal(float x, float target, float eps = 1e-6); ...@@ -43,16 +43,14 @@ bool Equal(float x, float target, float eps = 1e-6);
bool Equal(double x, double target, double eps = 1e-6); bool Equal(double x, double target, double eps = 1e-6);
// @brief whether rect1 is covered by rect2 // @brief whether rect1 is covered by rect2
template<typename T> template <typename T>
bool IsCovered(const base::Rect<T> &rect1, bool IsCovered(const base::Rect<T> &rect1, const base::Rect<T> &rect2,
const base::Rect<T> &rect2,
float thresh) { float thresh) {
base::RectF inter = rect1 & rect2; base::RectF inter = rect1 & rect2;
return inter.Area() / rect1.Area() > thresh; return inter.Area() / rect1.Area() > thresh;
} }
template<typename T> template <typename T>
bool IsCoveredHorizon(const base::Rect<T> &rect1, bool IsCoveredHorizon(const base::Rect<T> &rect1, const base::Rect<T> &rect2,
const base::Rect<T> &rect2,
float thresh) { float thresh) {
base::RectF inter = rect1 & rect2; base::RectF inter = rect1 & rect2;
if (inter.Area() > 0) { if (inter.Area() > 0) {
...@@ -60,9 +58,8 @@ bool IsCoveredHorizon(const base::Rect<T> &rect1, ...@@ -60,9 +58,8 @@ bool IsCoveredHorizon(const base::Rect<T> &rect1,
} }
return false; return false;
} }
template<typename T> template <typename T>
bool IsCoveredVertical(const base::Rect<T> &rect1, bool IsCoveredVertical(const base::Rect<T> &rect1, const base::Rect<T> &rect2,
const base::Rect<T> &rect2,
float thresh) { float thresh) {
base::RectF inter = rect1 & rect2; base::RectF inter = rect1 & rect2;
if (inter.Area() > 0) { if (inter.Area() > 0) {
...@@ -71,7 +68,7 @@ bool IsCoveredVertical(const base::Rect<T> &rect1, ...@@ -71,7 +68,7 @@ bool IsCoveredVertical(const base::Rect<T> &rect1,
return false; return false;
} }
template<typename T> template <typename T>
bool Contain(const std::vector<T> &array, const T &element) { bool Contain(const std::vector<T> &array, const T &element) {
for (const auto &item : array) { for (const auto &item : array) {
if (item == element) { if (item == element) {
...@@ -81,33 +78,26 @@ bool Contain(const std::vector<T> &array, const T &element) { ...@@ -81,33 +78,26 @@ bool Contain(const std::vector<T> &array, const T &element) {
return false; return false;
} }
template<typename T> template <typename T>
bool OutOfValidRegion(const base::BBox2D<T> box, bool OutOfValidRegion(const base::BBox2D<T> box, const T width, const T height,
const T width,
const T height,
const T border_size = 0) { const T border_size = 0) {
if (box.xmin < border_size || box.ymin < border_size) { if (box.xmin < border_size || box.ymin < border_size) {
return true; return true;
} }
if (box.xmax + border_size > width || if (box.xmax + border_size > width || box.ymax + border_size > height) {
box.ymax + border_size > height) {
return true; return true;
} }
return false; return false;
} }
template<typename T> template <typename T>
bool OutOfValidRegion(const base::Rect<T> rect, bool OutOfValidRegion(const base::Rect<T> rect, const T width, const T height,
const T width,
const T height,
const T border_size = 0) { const T border_size = 0) {
base::BBox2D<T> box(rect); base::BBox2D<T> box(rect);
return OutOfValidRegion(box, width, height, border_size); return OutOfValidRegion(box, width, height, border_size);
} }
template<typename T> template <typename T>
void RefineBox(const base::Rect<T> &box_in, void RefineBox(const base::Rect<T> &box_in, const T width, const T height,
const T width,
const T height,
base::Rect<T> *box_out) { base::Rect<T> *box_out) {
if (!box_out) { if (!box_out) {
return; return;
...@@ -129,10 +119,11 @@ void RefineBox(const base::Rect<T> &box_in, ...@@ -129,10 +119,11 @@ void RefineBox(const base::Rect<T> &box_in,
box_out->y = 0; box_out->y = 0;
box_out->height = 0; box_out->height = 0;
} }
box_out->width = (box_out->x + box_out->width <= width) ? box_out->width : box_out->width = (box_out->x + box_out->width <= width) ? box_out->width
width - box_out->x; : width - box_out->x;
box_out->height = (box_out->y + box_out->height <= height) ? box_out->height : box_out->height = (box_out->y + box_out->height <= height)
height - box_out->y; ? box_out->height
: height - box_out->y;
if (box_out->width < 0) { if (box_out->width < 0) {
box_out->width = 0; box_out->width = 0;
} }
...@@ -141,10 +132,8 @@ void RefineBox(const base::Rect<T> &box_in, ...@@ -141,10 +132,8 @@ void RefineBox(const base::Rect<T> &box_in,
} }
} }
template<typename T> template <typename T>
void RefineBox(const base::BBox2D<T> &box_in, void RefineBox(const base::BBox2D<T> &box_in, const T width, const T height,
const T width,
const T height,
base::BBox2D<T> *box_out) { base::BBox2D<T> *box_out) {
if (!box_out) { if (!box_out) {
return; return;
...@@ -157,21 +146,18 @@ void RefineBox(const base::BBox2D<T> &box_in, ...@@ -157,21 +146,18 @@ void RefineBox(const base::BBox2D<T> &box_in,
bool LoadAnchors(const std::string &path, std::vector<float> *anchors); bool LoadAnchors(const std::string &path, std::vector<float> *anchors);
bool LoadTypes(const std::string &path, bool LoadTypes(const std::string &path,
std::vector<base::ObjectSubType> *types); std::vector<base::ObjectSubType> *types);
bool LoadExpand(const std::string &path, bool LoadExpand(const std::string &path, std::vector<float> *expands);
std::vector<float> *expands);
bool ResizeCPU(const base::Blob<uint8_t> &src_gpu, bool ResizeCPU(const base::Blob<uint8_t> &src_gpu,
std::shared_ptr<base::Blob<float> > dst, std::shared_ptr<base::Blob<float>> dst, int stepwidth,
int stepwidth,
int start_axis); int start_axis);
void GetCybertronWorkRoot(std::string *work_root); void GetCybertronWorkRoot(std::string *work_root);
void FillObjectPolygonFromBBox3D(base::Object *object_ptr); void FillObjectPolygonFromBBox3D(base::Object *object_ptr);
template<typename T> template <typename T>
void CalculateMeanAndVariance(const std::vector<T> &data, void CalculateMeanAndVariance(const std::vector<T> &data, T *mean,
T* mean, T* variance) { T *variance) {
if (!mean || !variance) { if (!mean || !variance) {
return; return;
} }
...@@ -184,11 +170,10 @@ void CalculateMeanAndVariance(const std::vector<T> &data, ...@@ -184,11 +170,10 @@ void CalculateMeanAndVariance(const std::vector<T> &data,
*mean = sum / data.size(); *mean = sum / data.size();
std::vector<T> diff(data.size()); std::vector<T> diff(data.size());
std::transform(data.begin(), data.end(), diff.begin(), [mean](T x) { std::transform(data.begin(), data.end(), diff.begin(),
return x - *mean; [mean](T x) { return x - *mean; });
});
T sum_of_diff_sqrs = std::inner_product(diff.begin(), diff.end(), T sum_of_diff_sqrs = std::inner_product(diff.begin(), diff.end(),
diff.begin(), static_cast<T>(0)); diff.begin(), static_cast<T>(0));
*variance = sum_of_diff_sqrs / data.size(); *variance = sum_of_diff_sqrs / data.size();
} }
......
...@@ -14,8 +14,7 @@ cuda_library( ...@@ -14,8 +14,7 @@ cuda_library(
deps = [ deps = [
"@cuda", "@cuda",
"//cybertron", "//cybertron",
"//modules/perception/camera/common:common", "//modules/perception/camera/common:camera_frame",
"//modules/perception/inference/utils:inference_util_lib",
"//modules/perception/inference/utils:inference_gemm_lib", "//modules/perception/inference/utils:inference_gemm_lib",
], ],
) )
......
...@@ -385,7 +385,7 @@ ...@@ -385,7 +385,7 @@
# "-lopencv_highgui", # "-lopencv_highgui",
# ], # ],
# deps = [ # deps = [
# "//external:gflags", # "//cybertron",
# "//modules/perception/camera/lib/lane/detector/denseline:denseline_lane_detector", # "//modules/perception/camera/lib/lane/detector/denseline:denseline_lane_detector",
# "//modules/perception/base:base", # "//modules/perception/base:base",
# "//modules/perception/common/io:io_util", # "//modules/perception/common/io:io_util",
...@@ -712,6 +712,7 @@ ...@@ -712,6 +712,7 @@
# "-lcaffe", # "-lcaffe",
# ], # ],
# deps = [ # deps = [
# "//cybertron",
# "//modules/perception/base:distortion_model", # "//modules/perception/base:distortion_model",
# "//modules/perception/common/io:io_util", # "//modules/perception/common/io:io_util",
# "//modules/perception/camera/lib/traffic_light/tracker:semantic_decision", # "//modules/perception/camera/lib/traffic_light/tracker:semantic_decision",
......
...@@ -14,19 +14,14 @@ ...@@ -14,19 +14,14 @@
* limitations under the License. * limitations under the License.
*****************************************************************************/ *****************************************************************************/
#include "modules/perception/camera/test/camera_common_undistortion.h" #include "modules/perception/camera/test/camera_common_undistortion.h"
#include <npp.h>
#include <glog/logging.h> #include <npp.h>
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
#include <yaml-cpp/yaml.h> #include <yaml-cpp/yaml.h>
#include <opencv2/core/core.hpp> #include <opencv2/core/core.hpp>
#include <opencv2/opencv.hpp> #include <opencv2/opencv.hpp>
#include <vector> #include <vector>
// #include "cybertron/common/log.h"
namespace apollo { namespace apollo {
namespace perception { namespace perception {
namespace camera { namespace camera {
...@@ -169,7 +164,6 @@ int ImageGpuPreprocessHandler::load_camera_intrinsics( ...@@ -169,7 +164,6 @@ int ImageGpuPreprocessHandler::load_camera_intrinsics(
<< "File not exists: " << intrinsics_path; << "File not exists: " << intrinsics_path;
YAML::Node node = YAML::LoadFile(intrinsics_path); YAML::Node node = YAML::LoadFile(intrinsics_path);
if (node.IsNull()) { if (node.IsNull()) {
// AINFO << "Load " << intrinsics_path << " failed! please check!";
return -1; return -1;
} }
D->resize(node["D"].size()); D->resize(node["D"].size());
......
...@@ -13,13 +13,14 @@ ...@@ -13,13 +13,14 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*****************************************************************************/ *****************************************************************************/
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <opencv2/opencv.hpp> #include <opencv2/opencv.hpp>
#include <fstream> #include <fstream>
#include <iostream> #include <iostream>
#include "cybertron/common/log.h"
#include "modules/perception/camera/lib/lane/detector/denseline/denseline_lane_detector.h" #include "modules/perception/camera/lib/lane/detector/denseline/denseline_lane_detector.h"
#include "glog/logging.h"
#include "gflags/gflags.h"
#include "modules/perception/base/distortion_model.h" #include "modules/perception/base/distortion_model.h"
#include "modules/perception/common/io/io_util.h" #include "modules/perception/common/io/io_util.h"
......
...@@ -18,9 +18,8 @@ ...@@ -18,9 +18,8 @@
#include <iostream> #include <iostream>
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "glog/logging.h"
#include "gflags/gflags.h"
#include "cybertron/common/log.h"
#include "modules/perception/base/distortion_model.h" #include "modules/perception/base/distortion_model.h"
#include "modules/perception/common/io/io_util.h" #include "modules/perception/common/io/io_util.h"
#include "modules/perception/camera/lib/traffic_light/tracker/semantic_decision.h" #include "modules/perception/camera/lib/traffic_light/tracker/semantic_decision.h"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册