mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-16 05:30:58 +08:00
[Model] Refactor YOLOv7 module (#611)
* add paddle_trt in benchmark * update benchmark in device * update benchmark * update result doc * fixed for CI * update python api_docs * update index.rst * add runtime cpp examples * deal with comments * Update infer_paddle_tensorrt.py * Add runtime quick start * deal with comments * fixed reused_input_tensors&&reused_output_tensors * fixed docs * fixed headpose typo * fixed typo * refactor yolov5 * update model infer * refactor pybind for yolov5 * rm origin yolov5 * fixed bugs * rm cuda preprocess * fixed bugs * fixed bugs * fixed bug * fixed bug * fix pybind * rm useless code * add convert_and_permute * fixed bugs * fixed im_info for bs_predict * fixed bug * add bs_predict for yolov5 * Add runtime test and batch eval * deal with comments * fixed bug * update testcase * fixed batch eval bug * fixed preprocess bug * refactor yolov7 * add yolov7 testcase * rm resize_after_load and add is_scale_up * fixed bug * set multi_label true Co-authored-by: Jason <928090362@qq.com>
This commit is contained in:
@@ -24,7 +24,7 @@ YOLOv5Preprocessor::YOLOv5Preprocessor() {
|
||||
padding_value_ = {114.0, 114.0, 114.0};
|
||||
is_mini_pad_ = false;
|
||||
is_no_pad_ = false;
|
||||
is_scale_up_ = false;
|
||||
is_scale_up_ = true;
|
||||
stride_ = 32;
|
||||
max_wh_ = 7680.0;
|
||||
}
|
||||
@@ -50,7 +50,9 @@ void YOLOv5Preprocessor::LetterBox(FDMat* mat) {
|
||||
resize_h = size_[1];
|
||||
resize_w = size_[0];
|
||||
}
|
||||
Resize::Run(mat, resize_w, resize_h);
|
||||
if (std::fabs(scale - 1.0f) > 1e-06) {
|
||||
Resize::Run(mat, resize_w, resize_h);
|
||||
}
|
||||
if (pad_h > 0 || pad_w > 0) {
|
||||
float half_h = pad_h * 1.0 / 2;
|
||||
int top = int(round(half_h - 0.1));
|
||||
@@ -67,19 +69,6 @@ bool YOLOv5Preprocessor::Preprocess(FDMat* mat, FDTensor* output,
|
||||
// Record the shape of image and the shape of preprocessed image
|
||||
(*im_info)["input_shape"] = {static_cast<float>(mat->Height()),
|
||||
static_cast<float>(mat->Width())};
|
||||
|
||||
// process after image load
|
||||
double ratio = (size_[0] * 1.0) / std::max(static_cast<float>(mat->Height()),
|
||||
static_cast<float>(mat->Width()));
|
||||
if (std::fabs(ratio - 1.0f) > 1e-06) {
|
||||
int interp = cv::INTER_AREA;
|
||||
if (ratio > 1.0) {
|
||||
interp = cv::INTER_LINEAR;
|
||||
}
|
||||
int resize_h = int(mat->Height() * ratio);
|
||||
int resize_w = int(mat->Width() * ratio);
|
||||
Resize::Run(mat, resize_w, resize_h, -1, -1, interp);
|
||||
}
|
||||
// yolov5's preprocess steps
|
||||
// 1. letterbox
|
||||
// 2. convert_and_permute(swap_rb=true)
|
||||
|
Reference in New Issue
Block a user