mmdeploy/csrc/codebase/mmdet/object_detection.h
lzhangzz a494a6f6ff
[SDK] sync changes according to performance benchmarks (#297)
* sync SDK changes according to performance benchmarks

* fix end-of-file lint

* fix clang-format issue

* fix clang-format by adding 'clang-format off'

* remove useless casts

* remove 'data' argument of 'operator()'

* change 'Tensor2Img' to 'TensorToImg' according to spec

* correct tensor's name according spec

Co-authored-by: lvhan028 <lvhan_028@163.com>
2021-12-16 13:51:22 +08:00

38 lines
1.2 KiB
C++

// Copyright (c) OpenMMLab. All rights reserved.
#ifndef MMDEPLOY_SRC_CODEBASE_MMDET_OBJECT_DETECTION_H_
#define MMDEPLOY_SRC_CODEBASE_MMDET_OBJECT_DETECTION_H_
#include "codebase/mmdet/mmdet.h"
#include "core/tensor.h"
#include "core/utils/formatter.h"
namespace mmdeploy::mmdet {
class ResizeBBox : public MMDetection {
public:
explicit ResizeBBox(const Value& cfg);
Result<Value> operator()(const Value& prep_res, const Value& infer_res);
protected:
Result<DetectorOutput> DispatchGetBBoxes(const Value& prep_res, const Tensor& dets,
const Tensor& labels);
template <typename T>
Result<DetectorOutput> GetBBoxes(const Value& prep_res, const Tensor& dets, const Tensor& labels);
std::array<float, 4> MapToOriginImage(float left, float top, float right, float bottom,
const float* scale_factor, float x_offset, float y_offset,
int ori_width, int ori_height);
protected:
constexpr static Device kHost{0, 0};
float score_thr_{0.f};
float min_bbox_size_{0.f};
};
} // namespace mmdeploy::mmdet
#endif // MMDEPLOY_SRC_CODEBASE_MMDET_OBJECT_DETECTION_H_