[Bug Fix] Update RKYOLO code format (#1254)

* 更新rkyolo细节

* 更新rkyolov5 format
This commit is contained in:
Zheng-Bicheng
2023-02-08 19:46:11 +08:00
committed by GitHub
parent 8e2b0c1502
commit e077c005df
3 changed files with 7 additions and 32 deletions

View File

@@ -40,12 +40,12 @@ class FASTDEPLOY_DECL RKYOLOPostprocessor {
std::vector<DetectionResult>* results);
/// Set nms_threshold, default 0.45
void SetNMSThreshold(const float& nms_threshold) {
void SetNMSThreshold(float nms_threshold) {
nms_threshold_ = nms_threshold;
}
/// Set conf_threshold, default 0.25
void SetConfThreshold(const float& conf_threshold) {
void SetConfThreshold(float conf_threshold) {
conf_threshold_ = conf_threshold;
}
@@ -56,21 +56,21 @@ class FASTDEPLOY_DECL RKYOLOPostprocessor {
float GetNMSThreshold() const { return nms_threshold_; }
/// Set height and weight
void SetHeightAndWeight(int& height, int& width) {
void SetHeightAndWeight(int height,int width) {
height_ = height;
width_ = width;
}
/// Set pad_hw_values
void SetPadHWValues(std::vector<std::vector<int>> pad_hw_values) {
void SetPadHWValues(const std::vector<std::vector<int>>& pad_hw_values) {
pad_hw_values_ = pad_hw_values;
}
/// Set scale
void SetScale(std::vector<float> scale) { scale_ = scale; }
void SetScale(const std::vector<float>& scale) { scale_ = scale; }
/// Set Anchor
void SetAnchor(std::vector<int> anchors, int anchor_per_branch) {
void SetAnchor(const std::vector<int>& anchors, int anchor_per_branch) {
anchors_ = anchors;
anchor_per_branch_ = anchor_per_branch;
}

View File

@@ -18,26 +18,6 @@ namespace detection {
float Clamp(float val, int min, int max) {
return val > min ? (val < max ? val : max) : min;
}
float Sigmoid(float x) { return 1.0 / (1.0 + expf(-x)); }
float UnSigmoid(float y) { return -1.0 * logf((1.0 / y) - 1.0); }
inline int32_t __clip(float val, float min, float max) {
float f = val <= min ? min : (val >= max ? max : val);
return f;
}
int8_t QntF32ToAffine(float f32, int32_t zp, float scale) {
float dst_val = (f32 / scale) + zp;
int8_t res = (int8_t)__clip(dst_val, -128, 127);
return res;
}
float DeqntAffineToF32(int8_t qnt, int32_t zp, float scale) {
return ((float)qnt - (float)zp) * scale;
}
static float CalculateOverlap(float xmin0, float ymin0, float xmax0,
float ymax0, float xmin1, float ymin1,
float xmax1, float ymax1) {

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#include <stdint.h>
#include <cstdint>
#include <cmath>
#include <vector>
@@ -20,11 +20,6 @@ namespace fastdeploy {
namespace vision {
namespace detection {
float Clamp(float val, int min, int max);
float Sigmoid(float x);
float UnSigmoid(float y);
inline static int32_t __clip(float val, float min, float max);
int8_t QntF32ToAffine(float f32, int32_t zp, float scale);
float DeqntAffineToF32(int8_t qnt, int32_t zp, float scale);
int NMS(int valid_count, std::vector<float>& output_locations,
std::vector<int>& class_id, std::vector<int>& order, float threshold,
bool class_agnostic);