Skip to content

Commit

Permalink
[Bug Fix] fix yolov5face scale error in small image (PaddlePaddle#649)
Browse files Browse the repository at this point in the history
* [Bug Fix] fix android app detail page errors

* [Android] fix realtime camera mode and shutter

* [Bug Fix] fix AllocateSegmentationResultFromJava error

* [Bug Fix] fix camera preview size setting problem

* [Model] use uint8 buffer instead of fp32 in ppseg postprocess

* [Model] revert changes in ppseg

* [Model] revert postprocess changes in ppseg

* [Android] add fastdeploy android sdk download task

* [Bug Fix] fix yolov5face scale error in small image
  • Loading branch information
DefTruth authored Nov 21, 2022
1 parent 04566e5 commit 823b3f7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
5 changes: 4 additions & 1 deletion fastdeploy/vision/facedet/contrib/scrfd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ bool SCRFD::Preprocess(Mat* mat, FDTensor* output,
// we decided to hide this extra resize. It won't make much
// difference to the final result.
if (std::fabs(ratio - 1.0f) > 1e-06) {
int interp = cv::INTER_AREA;
int interp = cv::INTER_LINEAR;
if (ratio > 1.0) {
interp = cv::INTER_LINEAR;
}
Expand Down Expand Up @@ -224,6 +224,9 @@ bool SCRFD::Postprocess(
float ipt_h = iter_ipt->second[0];
float ipt_w = iter_ipt->second[1];
float scale = std::min(out_h / ipt_h, out_w / ipt_w);
if (!is_scale_up) {
scale = std::min(scale, 1.0f);
}
float pad_h = (out_h - ipt_h * scale) / 2.0f;
float pad_w = (out_w - ipt_w * scale) / 2.0f;
if (is_mini_pad) {
Expand Down
5 changes: 4 additions & 1 deletion fastdeploy/vision/facedet/contrib/yolov5face.cc
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ bool YOLOv5Face::Preprocess(
// we decided to hide this extra resize. It won't make much
// difference to the final result.
if (std::fabs(ratio - 1.0f) > 1e-06) {
int interp = cv::INTER_AREA;
int interp = cv::INTER_LINEAR;
if (ratio > 1.0) {
interp = cv::INTER_LINEAR;
}
Expand Down Expand Up @@ -216,6 +216,9 @@ bool YOLOv5Face::Postprocess(
float ipt_h = iter_ipt->second[0];
float ipt_w = iter_ipt->second[1];
float scale = std::min(out_h / ipt_h, out_w / ipt_w);
if (!is_scale_up) {
scale = std::min(scale, 1.0f);
}
float pad_h = (out_h - ipt_h * scale) / 2.f;
float pad_w = (out_w - ipt_w * scale) / 2.f;
if (is_mini_pad) {
Expand Down
1 change: 1 addition & 0 deletions java/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ dependencies {
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:28.0.0'
implementation 'org.jetbrains:annotations:15.0'
// implementation project(path: ':fastdeploy')
//noinspection GradleDependency
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
Expand Down

0 comments on commit 823b3f7

Please sign in to comment.