mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-08 18:11:00 +08:00
[Bug Fix] fixed ppdet postprocess empty result error (#691)
* [Android] Add CxxBuffer to native PaddleSegModel * [Android] Add PaddleSeg android app example * [Android] Add SCRFD android app example * [Doc] fix typos * [Android] revert camera setting changes * [Bug Fix] fixed ppdet postprocess empty result error
This commit is contained in:
@@ -488,6 +488,12 @@ if(MSVC)
|
|||||||
# disable warnings for dll export
|
# disable warnings for dll export
|
||||||
target_compile_options(${LIBRARY_NAME} PRIVATE "$<$<BUILD_INTERFACE:$<COMPILE_LANGUAGE:CXX>>:/wd4251>$<$<BUILD_INTERFACE:$<COMPILE_LANGUAGE:CUDA>>:-Xcompiler=/wd4251>")
|
target_compile_options(${LIBRARY_NAME} PRIVATE "$<$<BUILD_INTERFACE:$<COMPILE_LANGUAGE:CXX>>:/wd4251>$<$<BUILD_INTERFACE:$<COMPILE_LANGUAGE:CUDA>>:-Xcompiler=/wd4251>")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (ANDROID)
|
||||||
|
find_library(log-lib log)
|
||||||
|
list(APPEND DEPEND_LIBS ${log-lib})
|
||||||
|
endif()
|
||||||
|
|
||||||
target_link_libraries(${LIBRARY_NAME} ${DEPEND_LIBS})
|
target_link_libraries(${LIBRARY_NAME} ${DEPEND_LIBS})
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
|
@@ -20,7 +20,11 @@ namespace fastdeploy {
|
|||||||
FDLogger::FDLogger(bool verbose, const std::string& prefix) {
|
FDLogger::FDLogger(bool verbose, const std::string& prefix) {
|
||||||
verbose_ = verbose;
|
verbose_ = verbose;
|
||||||
line_ = "";
|
line_ = "";
|
||||||
|
#ifdef __ANDROID__
|
||||||
|
prefix_ = std::string("[FastDeploy]") + prefix;
|
||||||
|
#else
|
||||||
prefix_ = prefix;
|
prefix_ = prefix;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
FDLogger& FDLogger::operator<<(std::ostream& (*os)(std::ostream&)) {
|
FDLogger& FDLogger::operator<<(std::ostream& (*os)(std::ostream&)) {
|
||||||
@@ -28,6 +32,9 @@ FDLogger& FDLogger::operator<<(std::ostream& (*os)(std::ostream&)) {
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
std::cout << prefix_ << " " << line_ << std::endl;
|
std::cout << prefix_ << " " << line_ << std::endl;
|
||||||
|
#ifdef __ANDROID__
|
||||||
|
__android_log_print(ANDROID_LOG_INFO, prefix_.c_str(), "%s", line_.c_str());
|
||||||
|
#endif
|
||||||
line_ = "";
|
line_ = "";
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
@@ -24,6 +24,10 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#ifdef __ANDROID__
|
||||||
|
#include <android/log.h> // NOLINT
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
#ifdef FASTDEPLOY_LIB
|
#ifdef FASTDEPLOY_LIB
|
||||||
#define FASTDEPLOY_DECL __declspec(dllexport)
|
#define FASTDEPLOY_DECL __declspec(dllexport)
|
||||||
@@ -54,10 +58,15 @@ class FASTDEPLOY_DECL FDLogger {
|
|||||||
line_ += ss.str();
|
line_ += ss.str();
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
FDLogger& operator<<(std::ostream& (*os)(std::ostream&));
|
FDLogger& operator<<(std::ostream& (*os)(std::ostream&));
|
||||||
|
|
||||||
~FDLogger() {
|
~FDLogger() {
|
||||||
if (!verbose_ && line_ != "") {
|
if (!verbose_ && line_ != "") {
|
||||||
std::cout << line_ << std::endl;
|
std::cout << line_ << std::endl;
|
||||||
|
#ifdef __ANDROID__
|
||||||
|
__android_log_print(ANDROID_LOG_INFO, prefix_.c_str(), "%s", line_.c_str());
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -75,12 +75,6 @@ bool PaddleDetPostprocessor::Run(const std::vector<FDTensor>& tensors,
|
|||||||
tensors[0].shape.size());
|
tensors[0].shape.size());
|
||||||
return ProcessUnDecodeResults(tensors, results);
|
return ProcessUnDecodeResults(tensors, results);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tensors[0].shape[0] == 0) {
|
|
||||||
// No detected boxes
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get number of boxes for each input image
|
// Get number of boxes for each input image
|
||||||
std::vector<int> num_boxes(tensors[1].shape[0]);
|
std::vector<int> num_boxes(tensors[1].shape[0]);
|
||||||
int total_num_boxes = 0;
|
int total_num_boxes = 0;
|
||||||
@@ -114,6 +108,12 @@ bool PaddleDetPostprocessor::Run(const std::vector<FDTensor>& tensors,
|
|||||||
|
|
||||||
// Get boxes for each input image
|
// Get boxes for each input image
|
||||||
results->resize(num_boxes.size());
|
results->resize(num_boxes.size());
|
||||||
|
|
||||||
|
if (tensors[0].shape[0] == 0) {
|
||||||
|
// No detected boxes
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
const auto* box_data = static_cast<const float*>(tensors[0].CpuData());
|
const auto* box_data = static_cast<const float*>(tensors[0].CpuData());
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
for (size_t i = 0; i < num_boxes.size(); ++i) {
|
for (size_t i = 0; i < num_boxes.size(); ++i) {
|
||||||
|
Reference in New Issue
Block a user