forked from PaddlePaddle/FastDeploy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from PaddlePaddle/develop
Develop
- Loading branch information
Showing
78 changed files
with
3,465 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
*.jpg | ||
*.png | ||
*.jpeg | ||
*.onnx | ||
*.engine | ||
*.pd* | ||
*.nb | ||
bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
function(add_fastdeploy_executable field url model) | ||
# temp target name/file var in function scope | ||
set(TEMP_TARGET_FILE ${PROJECT_SOURCE_DIR}/examples/${field}/${url}_${model}.cc) | ||
set(TEMP_TARGET_NAME ${field}_${url}_${model}) | ||
if (EXISTS ${TEMP_TARGET_FILE} AND TARGET fastdeploy) | ||
add_executable(${TEMP_TARGET_NAME} ${TEMP_TARGET_FILE}) | ||
target_link_libraries(${TEMP_TARGET_NAME} PUBLIC fastdeploy) | ||
message(STATUS "Found source file: [${field}/${url}_${model}.cc], ADD!!! fastdeploy executable: [${TEMP_TARGET_NAME}] !") | ||
else () | ||
message(WARNING "Can not found source file: [${field}/${url}_${model}.cc], SKIP!!! fastdeploy executable: [${TEMP_TARGET_NAME}] !") | ||
endif() | ||
unset(TEMP_TARGET_FILE) | ||
unset(TEMP_TARGET_NAME) | ||
endfunction() | ||
|
||
# vision examples | ||
if (WITH_VISION_EXAMPLES) | ||
add_fastdeploy_executable(vision ultralytics yolov5) | ||
add_fastdeploy_executable(vision ppdet ppyoloe) | ||
add_fastdeploy_executable(vision meituan yolov6) | ||
add_fastdeploy_executable(vision wongkinyiu yolov7) | ||
add_fastdeploy_executable(vision megvii yolox) | ||
endif() | ||
|
||
# other examples ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
images/*.jpg | ||
images/*.jpeg | ||
images/*.png | ||
models/*.onnx | ||
models/*.pd* | ||
models/*.engine | ||
models/*.trt | ||
models/*.nb | ||
outputs/*.jpg | ||
outputs/*.jpeg | ||
outputs/*.png |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
*.jpg | ||
*.jpeg | ||
*.png |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
*.onnx | ||
*.engine | ||
*.pd* | ||
*.nb | ||
*.trt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
*.jpg | ||
*.png | ||
*.jpeg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#include "fastdeploy/vision.h" | ||
|
||
int main() { | ||
namespace vis = fastdeploy::vision; | ||
|
||
std::string model_file = "../resources/models/yolox_s.onnx"; | ||
std::string img_path = "../resources/images/bus.jpg"; | ||
std::string vis_path = "../resources/outputs/megvii_yolox_vis_result.jpg"; | ||
|
||
auto model = vis::megvii::YOLOX(model_file); | ||
if (!model.Initialized()) { | ||
std::cerr << "Init Failed! Model: " << model_file << std::endl; | ||
return -1; | ||
} else { | ||
std::cout << "Init Done! Model:" << model_file << std::endl; | ||
} | ||
model.EnableDebug(); | ||
|
||
cv::Mat im = cv::imread(img_path); | ||
cv::Mat vis_im = im.clone(); | ||
|
||
vis::DetectionResult res; | ||
if (!model.Predict(&im, &res)) { | ||
std::cerr << "Prediction Failed." << std::endl; | ||
return -1; | ||
} else { | ||
std::cout << "Prediction Done!" << std::endl; | ||
} | ||
|
||
// 输出预测框结果 | ||
std::cout << res.Str() << std::endl; | ||
|
||
// 可视化预测结果 | ||
vis::Visualize::VisDetection(&vis_im, res); | ||
cv::imwrite(vis_path, vis_im); | ||
std::cout << "Detect Done! Saved: " << vis_path << std::endl; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#include "fastdeploy/vision.h" | ||
|
||
int main() { | ||
namespace vis = fastdeploy::vision; | ||
|
||
std::string model_file = "../resources/models/yolov6s.onnx"; | ||
std::string img_path = "../resources/images/bus.jpg"; | ||
std::string vis_path = "../resources/outputs/meituan_yolov6_vis_result.jpg"; | ||
|
||
auto model = vis::meituan::YOLOv6(model_file); | ||
if (!model.Initialized()) { | ||
std::cerr << "Init Failed! Model: " << model_file << std::endl; | ||
return -1; | ||
} else { | ||
std::cout << "Init Done! Model:" << model_file << std::endl; | ||
} | ||
model.EnableDebug(); | ||
|
||
cv::Mat im = cv::imread(img_path); | ||
cv::Mat vis_im = im.clone(); | ||
|
||
vis::DetectionResult res; | ||
if (!model.Predict(&im, &res)) { | ||
std::cerr << "Prediction Failed." << std::endl; | ||
return -1; | ||
} else { | ||
std::cout << "Prediction Done!" << std::endl; | ||
} | ||
|
||
// 输出预测框结果 | ||
std::cout << res.Str() << std::endl; | ||
|
||
// 可视化预测结果 | ||
vis::Visualize::VisDetection(&vis_im, res); | ||
cv::imwrite(vis_path, vis_im); | ||
std::cout << "Detect Done! Saved: " << vis_path << std::endl; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#include "fastdeploy/vision.h" | ||
|
||
int main() { | ||
namespace vis = fastdeploy::vision; | ||
|
||
std::string model_file = "ppyoloe_crn_l_300e_coco/model.pdmodel"; | ||
std::string params_file = "ppyoloe_crn_l_300e_coco/model.pdiparams"; | ||
std::string config_file = "ppyoloe_crn_l_300e_coco/infer_cfg.yml"; | ||
std::string img_path = "test.jpeg"; | ||
std::string vis_path = "vis.jpeg"; | ||
|
||
auto model = vis::ppdet::PPYOLOE(model_file, params_file, config_file); | ||
if (!model.Initialized()) { | ||
std::cerr << "Init Failed." << std::endl; | ||
return -1; | ||
} | ||
|
||
cv::Mat im = cv::imread(img_path); | ||
cv::Mat vis_im = im.clone(); | ||
|
||
vis::DetectionResult res; | ||
if (!model.Predict(&im, &res)) { | ||
std::cerr << "Prediction Failed." << std::endl; | ||
return -1; | ||
} else { | ||
std::cout << "Prediction Done!" << std::endl; | ||
} | ||
|
||
// 输出预测框结果 | ||
std::cout << res.Str() << std::endl; | ||
|
||
// 可视化预测结果 | ||
vis::Visualize::VisDetection(&vis_im, res); | ||
cv::imwrite(vis_path, vis_im); | ||
std::cout << "Detect Done! Saved: " << vis_path << std::endl; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#include "fastdeploy/vision.h" | ||
|
||
int main() { | ||
namespace vis = fastdeploy::vision; | ||
|
||
std::string model_file = "../resources/models/yolov5s.onnx"; | ||
std::string img_path = "../resources/images/bus.jpg"; | ||
std::string vis_path = "../resources/outputs/ultralytics_yolov5_vis_result.jpg"; | ||
|
||
auto model = vis::ultralytics::YOLOv5(model_file); | ||
if (!model.Initialized()) { | ||
std::cerr << "Init Failed! Model: " << model_file << std::endl; | ||
return -1; | ||
} else { | ||
std::cout << "Init Done! Model:" << model_file << std::endl; | ||
} | ||
model.EnableDebug(); | ||
|
||
cv::Mat im = cv::imread(img_path); | ||
cv::Mat vis_im = im.clone(); | ||
|
||
vis::DetectionResult res; | ||
if (!model.Predict(&im, &res)) { | ||
std::cerr << "Prediction Failed." << std::endl; | ||
return -1; | ||
} else { | ||
std::cout << "Prediction Done!" << std::endl; | ||
} | ||
|
||
// 输出预测框结果 | ||
std::cout << res.Str() << std::endl; | ||
|
||
// 可视化预测结果 | ||
vis::Visualize::VisDetection(&vis_im, res); | ||
cv::imwrite(vis_path, vis_im); | ||
std::cout << "Detect Done! Saved: " << vis_path << std::endl; | ||
return 0; | ||
} |
Oops, something went wrong.