[Bug Fix] fixed labels setting of YOLOv5 (#1213)

修复自己训练的yolov5无法指定label个数的错误
This commit is contained in:
Zheng-Bicheng
2023-02-02 15:28:38 +08:00
committed by GitHub
parent a711f99c69
commit afa3b886f3
5 changed files with 24 additions and 96 deletions

View File

@@ -141,7 +141,6 @@ int RKYOLOPostprocessor::ProcessFP16(float* input, int* anchor, int grid_h,
} else {
limit_score = box_conf_f32 * class_prob_f32;
}
// printf("limit score: %f", limit_score);
if (limit_score > conf_threshold_) {
float box_x, box_y, box_w, box_h;
if (anchor_per_branch_ == 1) {

View File

@@ -55,26 +55,30 @@ class FASTDEPLOY_DECL RKYOLOPostprocessor {
/// Get nms_threshold, default 0.45
float GetNMSThreshold() const { return nms_threshold_; }
// Set height and weight
/// Set height and weight
void SetHeightAndWeight(int& height, int& width) {
height_ = height;
width_ = width;
}
// Set pad_hw_values
/// Set pad_hw_values
void SetPadHWValues(std::vector<std::vector<int>> pad_hw_values) {
pad_hw_values_ = pad_hw_values;
}
// Set scale
void SetScale(std::vector<float> scale) {
scale_ = scale;
/// Set scale
void SetScale(std::vector<float> scale) { scale_ = scale; }
/// Set Anchor
void SetAnchor(std::vector<int> anchors, int anchor_per_branch) {
anchors_ = anchors;
anchor_per_branch_ = anchor_per_branch;
}
// Set Anchor
void SetAnchor(std::vector<int> anchors, int anchor_per_branch) {
anchors_ = anchors;
anchor_per_branch_ = anchor_per_branch;
/// Set the number of class
void SetClassNum(int num) {
obj_class_num_ = num;
prob_box_size_ = obj_class_num_ + 5;
}
private:
@@ -85,12 +89,9 @@ class FASTDEPLOY_DECL RKYOLOPostprocessor {
int width_ = 0;
int anchor_per_branch_ = 0;
int ProcessFP16(float *input, int *anchor, int grid_h,
int grid_w, int stride,
std::vector<float> &boxes,
std::vector<float> &boxScores,
std::vector<int> &classId,
float threshold);
int ProcessFP16(float* input, int* anchor, int grid_h, int grid_w, int stride,
std::vector<float>& boxes, std::vector<float>& boxScores,
std::vector<int>& classId, float threshold);
// Model
int QuickSortIndiceInverse(std::vector<float>& input, int left, int right,
std::vector<int>& indices);