Fix directly visit member of FDTensor (#193)

* optimize tensorrt usage

* format code

* fix input shape error for onnx model

* Remove some code directly visit FDTensor member (#192)

remove some code directly visit FDTensor member

* fix directly visit member of FDTensor

Co-authored-by: root <root@bjyz-sys-gpu-kongming3.bjyz.baidu.com>
This commit is contained in:
Jason
2022-09-06 11:12:02 +08:00
committed by GitHub
parent 969531dcc8
commit e09ac18a7d
8 changed files with 36 additions and 48 deletions

View File

@@ -14,11 +14,11 @@
#pragma once
#include <set>
#include <vector>
#include "fastdeploy/core/fd_tensor.h"
#include "fastdeploy/utils/utils.h"
#include "fastdeploy/vision/common/result.h"
#include <set>
#include <vector>
namespace fastdeploy {
namespace vision {
@@ -87,8 +87,7 @@ void ArgmaxScoreMap(T infer_result_buffer, SegmentationResult* result,
}
}
template <typename T>
void NCHW2NHWC(FDTensor& infer_result) {
template <typename T> void NCHW2NHWC(FDTensor& infer_result) {
T* infer_result_buffer = reinterpret_cast<T*>(infer_result.MutableData());
int num = infer_result.shape[0];
int channel = infer_result.shape[1];
@@ -125,13 +124,13 @@ void SortDetectionResult(DetectionResult* output);
void SortDetectionResult(FaceDetectionResult* result);
// L2 Norm / cosine similarity (for face recognition, ...)
FASTDEPLOY_DECL std::vector<float> L2Normalize(
const std::vector<float>& values);
FASTDEPLOY_DECL std::vector<float>
L2Normalize(const std::vector<float>& values);
FASTDEPLOY_DECL float CosineSimilarity(const std::vector<float>& a,
const std::vector<float>& b,
bool normalized = true);
} // namespace utils
} // namespace vision
} // namespace fastdeploy
} // namespace utils
} // namespace vision
} // namespace fastdeploy