mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-29 19:12:30 +08:00
[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:
@@ -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;
|
||||
}
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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) {
|
||||
|
||||
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user