-
Notifications
You must be signed in to change notification settings - Fork 465
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Align fastdeploy prediction precision with yolov5 #11
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
8f59e0d
Align fastdeploy prediction precision with yolov5
felixhjh 678a502
Change name of Sort function to SortDetectionResult
felixhjh 7c2b054
Add stride max_wh is_mini_pad property in __init__.py and unify forma…
felixhjh 1bda14f
Change mergesort.cc to sort_det_res.cc
felixhjh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Empty file.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
// Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#include "fastdeploy/vision/utils/utils.h" | ||
|
||
namespace fastdeploy { | ||
namespace vision { | ||
namespace utils { | ||
|
||
void Merge(DetectionResult* result, size_t low, size_t mid, size_t high) { | ||
std::vector<std::array<float, 4>>& boxes = result->boxes; | ||
std::vector<float>& scores = result->scores; | ||
std::vector<int32_t>& label_ids = result->label_ids; | ||
std::vector<std::array<float, 4>> temp_boxes(boxes); | ||
std::vector<float> temp_scores(scores); | ||
std::vector<int32_t> temp_label_ids(label_ids); | ||
size_t i = low; | ||
size_t j = mid + 1; | ||
size_t k = i; | ||
for (; i <= mid && j <= high; k++) { | ||
if (temp_scores[i] >= temp_scores[j]) { | ||
scores[k] = temp_scores[i]; | ||
label_ids[k] = temp_label_ids[i]; | ||
boxes[k] = temp_boxes[i]; | ||
i++; | ||
} else { | ||
scores[k] = temp_scores[j]; | ||
label_ids[k] = temp_label_ids[j]; | ||
boxes[k] = temp_boxes[j]; | ||
j++; | ||
} | ||
} | ||
while (i <= mid) { | ||
scores[k] = temp_scores[i]; | ||
label_ids[k] = temp_label_ids[i]; | ||
boxes[k] = temp_boxes[i]; | ||
k++; | ||
i++; | ||
} | ||
while (j <= high) { | ||
scores[k] = temp_scores[j]; | ||
label_ids[k] = temp_label_ids[j]; | ||
boxes[k] = temp_boxes[j]; | ||
k++; | ||
j++; | ||
} | ||
} | ||
|
||
void MergeSort(DetectionResult* result, size_t low, size_t high) { | ||
if (low < high) { | ||
size_t mid = (high - low) / 2 + low; | ||
MergeSort(result, low, mid); | ||
MergeSort(result, mid + 1, high); | ||
Merge(result, low, mid, high); | ||
} | ||
} | ||
|
||
void SortDetectionResult(DetectionResult* result) { | ||
size_t low = 0; | ||
size_t high = result->scores.size() - 1; | ||
MergeSort(result, low, high); | ||
} | ||
|
||
} // namespace utils | ||
} // namespace vision | ||
} // namespace fastdeploy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
新增属性添加到
ultralytics/ultralytics_pybind.cc
和ultralytics/__init__.py