[Bug Fix] fix yolov5face scale error in small image (#649)

* [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
This commit is contained in:
DefTruth
2022-11-21 21:11:52 +08:00
committed by GitHub
parent 04566e5fe4
commit 823b3f7015
3 changed files with 9 additions and 2 deletions

View File

@@ -124,7 +124,7 @@ bool SCRFD::Preprocess(Mat* mat, FDTensor* output,
// we decided to hide this extra resize. It won't make much // we decided to hide this extra resize. It won't make much
// difference to the final result. // difference to the final result.
if (std::fabs(ratio - 1.0f) > 1e-06) { if (std::fabs(ratio - 1.0f) > 1e-06) {
int interp = cv::INTER_AREA; int interp = cv::INTER_LINEAR;
if (ratio > 1.0) { if (ratio > 1.0) {
interp = cv::INTER_LINEAR; interp = cv::INTER_LINEAR;
} }
@@ -224,6 +224,9 @@ bool SCRFD::Postprocess(
float ipt_h = iter_ipt->second[0]; float ipt_h = iter_ipt->second[0];
float ipt_w = iter_ipt->second[1]; float ipt_w = iter_ipt->second[1];
float scale = std::min(out_h / ipt_h, out_w / ipt_w); 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_h = (out_h - ipt_h * scale) / 2.0f;
float pad_w = (out_w - ipt_w * scale) / 2.0f; float pad_w = (out_w - ipt_w * scale) / 2.0f;
if (is_mini_pad) { if (is_mini_pad) {

View File

@@ -120,7 +120,7 @@ bool YOLOv5Face::Preprocess(
// we decided to hide this extra resize. It won't make much // we decided to hide this extra resize. It won't make much
// difference to the final result. // difference to the final result.
if (std::fabs(ratio - 1.0f) > 1e-06) { if (std::fabs(ratio - 1.0f) > 1e-06) {
int interp = cv::INTER_AREA; int interp = cv::INTER_LINEAR;
if (ratio > 1.0) { if (ratio > 1.0) {
interp = cv::INTER_LINEAR; interp = cv::INTER_LINEAR;
} }
@@ -216,6 +216,9 @@ bool YOLOv5Face::Postprocess(
float ipt_h = iter_ipt->second[0]; float ipt_h = iter_ipt->second[0];
float ipt_w = iter_ipt->second[1]; float ipt_w = iter_ipt->second[1];
float scale = std::min(out_h / ipt_h, out_w / ipt_w); 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_h = (out_h - ipt_h * scale) / 2.f;
float pad_w = (out_w - ipt_w * scale) / 2.f; float pad_w = (out_w - ipt_w * scale) / 2.f;
if (is_mini_pad) { if (is_mini_pad) {

View File

@@ -31,6 +31,7 @@ dependencies {
implementation 'com.android.support.constraint:constraint-layout:1.1.3' implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:28.0.0' implementation 'com.android.support:design:28.0.0'
implementation 'org.jetbrains:annotations:15.0' implementation 'org.jetbrains:annotations:15.0'
// implementation project(path: ':fastdeploy')
//noinspection GradleDependency //noinspection GradleDependency
testImplementation 'junit:junit:4.12' testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2' androidTestImplementation 'com.android.support.test:runner:1.0.2'