-
-
Notifications
You must be signed in to change notification settings - Fork 87
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 #25 from ShihaoLuo/main
update: deployment readme
- Loading branch information
Showing
125 changed files
with
34,411 additions
and
14 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,21 @@ | ||
cmake_minimum_required(VERSION 3.2) | ||
|
||
project(NCNNDeploy_test) | ||
|
||
if(CMAKE_BUILD_TYPE STREQUAL "") | ||
set(CMAKE_BUILD_TYPE "Release") | ||
endif() | ||
|
||
set(CMAKE_CXX_STANDARD 14) | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -O3") | ||
|
||
include_directories("~/Documents/Hsuanwu/deployment/ncnn/include") | ||
|
||
set(ncnn_DIR "~/Documents/Hsuanwu/deployment/ncnn/lib/cmake/ncnn" CACHE PATH "Directory that contains ncnnConfig.cmake") | ||
find_package(ncnn REQUIRED) | ||
|
||
add_executable(NCNNDeployTest NCNNDeployeTest.cpp) | ||
target_link_libraries(NCNNDeployTest ncnn) | ||
|
||
message("Build type: " ${CMAKE_BUILD_TYPE}) | ||
|
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,46 @@ | ||
#include "ncnn/net.h" | ||
|
||
int main(int argc, char** argv) | ||
{ | ||
ncnn::Net net; //net | ||
net.load_param(argv[1]);//load the param file | ||
net.load_model(argv[2]);//load the bin file | ||
|
||
|
||
ncnn::Mat in;//data tyoe Mat. Input/output data are stored in this structure. | ||
in.create(84 ,84, 9);//create a 9*84*84 tensor as the test onnx model requires. | ||
in.fill(3.0f);//fill the input data will 3.0. | ||
|
||
|
||
ncnn::Extractor ex = net.create_extractor();//create a extractor from net | ||
ex.set_light_mode(true); | ||
ex.set_num_threads(4); | ||
ex.input("input", in);//feed data into the extractor, then it will start infer automatically. | ||
ncnn::Mat out; | ||
ex.extract("output", out);//get infer result and put it into the out variable. | ||
|
||
|
||
for (int q=0; q<out.c; q++)//print the infer result | ||
{ | ||
const float* ptr = out.channel(q); | ||
for (int z=0; z<out.d; z++) | ||
{ | ||
for (int y=0; y<out.h; y++) | ||
{ | ||
for (int x=0; x<out.w; x++) | ||
{ | ||
printf("%f ", ptr[x]); | ||
} | ||
ptr += out.w; | ||
printf("\n"); | ||
} | ||
printf("\n"); | ||
} | ||
printf("------------------------\n"); | ||
} | ||
|
||
|
||
ex.clear();//destrcut the extractor | ||
net.clear();//destrcut the net | ||
return 0; | ||
} |
Oops, something went wrong.