[Model] Refactoring code of YOLOv5Cls with new model type (#1237)

* Refactoring code of YOLOv5Cls with new model type

* fix reviewed problem

* Normalize&HWC2CHW -> NormalizeAndPermute

* remove cast()
This commit is contained in:
guxukai
2023-02-08 11:19:00 +08:00
committed by GitHub
parent c5b414a774
commit 9cd00ad4c5
14 changed files with 593 additions and 248 deletions

View File

@@ -27,10 +27,9 @@ void CpuInfer(const std::string& model_file, const std::string& image_file) {
}
auto im = cv::imread(image_file);
auto im_bak = im.clone();
fastdeploy::vision::ClassifyResult res;
if (!model.Predict(&im, &res)) {
if (!model.Predict(im, &res)) {
std::cerr << "Failed to predict." << std::endl;
return;
}
@@ -48,10 +47,9 @@ void GpuInfer(const std::string& model_file, const std::string& image_file) {
}
auto im = cv::imread(image_file);
auto im_bak = im.clone();
fastdeploy::vision::ClassifyResult res;
if (!model.Predict(&im, &res)) {
if (!model.Predict(im, &res)) {
std::cerr << "Failed to predict." << std::endl;
return;
}
@@ -71,10 +69,9 @@ void TrtInfer(const std::string& model_file, const std::string& image_file) {
}
auto im = cv::imread(image_file);
auto im_bak = im.clone();
fastdeploy::vision::ClassifyResult res;
if (!model.Predict(&im, &res)) {
if (!model.Predict(im, &res)) {
std::cerr << "Failed to predict." << std::endl;
return;
}