-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
110 changed files
with
28,200 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,213 @@ | ||
--- | ||
Language: Cpp | ||
# BasedOnStyle: Google | ||
AccessModifierOffset: -4 | ||
AlignAfterOpenBracket: Align | ||
AlignArrayOfStructures: Left | ||
AlignConsecutiveMacros: Consecutive | ||
AlignConsecutiveAssignments: Consecutive | ||
AlignConsecutiveBitFields: None | ||
AlignConsecutiveDeclarations: None | ||
AlignEscapedNewlines: Left | ||
AlignOperands: Align | ||
AlignTrailingComments: true | ||
AllowAllArgumentsOnNextLine: false | ||
AllowAllConstructorInitializersOnNextLine: true | ||
AllowAllParametersOfDeclarationOnNextLine: false | ||
AllowShortEnumsOnASingleLine: true | ||
AllowShortBlocksOnASingleLine: Empty | ||
AllowShortCaseLabelsOnASingleLine: false | ||
AllowShortFunctionsOnASingleLine: Empty | ||
AllowShortLambdasOnASingleLine: All | ||
AllowShortIfStatementsOnASingleLine: Never | ||
AllowShortLoopsOnASingleLine: false | ||
AlwaysBreakAfterDefinitionReturnType: None | ||
AlwaysBreakAfterReturnType: None | ||
AlwaysBreakBeforeMultilineStrings: true | ||
AlwaysBreakTemplateDeclarations: Yes | ||
AttributeMacros: | ||
- __capability | ||
BinPackArguments: false | ||
BinPackParameters: false | ||
BraceWrapping: | ||
AfterCaseLabel: false | ||
AfterClass: false | ||
AfterControlStatement: Never | ||
AfterEnum: false | ||
AfterFunction: false | ||
AfterNamespace: false | ||
AfterObjCDeclaration: false | ||
AfterStruct: false | ||
AfterUnion: false | ||
AfterExternBlock: false | ||
BeforeCatch: false | ||
BeforeElse: false | ||
BeforeLambdaBody: false | ||
BeforeWhile: false | ||
IndentBraces: false | ||
SplitEmptyFunction: true | ||
SplitEmptyRecord: true | ||
SplitEmptyNamespace: true | ||
BreakBeforeBinaryOperators: None | ||
BreakBeforeConceptDeclarations: true | ||
BreakBeforeBraces: Custom | ||
BreakBeforeInheritanceComma: false | ||
BreakInheritanceList: BeforeColon | ||
BreakBeforeTernaryOperators: true | ||
BreakConstructorInitializersBeforeComma: false | ||
BreakConstructorInitializers: BeforeColon | ||
BreakAfterJavaFieldAnnotations: false | ||
BreakStringLiterals: true | ||
ColumnLimit: 80 | ||
CommentPragmas: '^ IWYU pragma:' | ||
CompactNamespaces: false | ||
ConstructorInitializerAllOnOneLineOrOnePerLine: true | ||
ConstructorInitializerIndentWidth: 4 | ||
ContinuationIndentWidth: 4 | ||
Cpp11BracedListStyle: true | ||
DeriveLineEnding: true | ||
DerivePointerAlignment: true | ||
DisableFormat: false | ||
EmptyLineAfterAccessModifier: Never | ||
EmptyLineBeforeAccessModifier: LogicalBlock | ||
ExperimentalAutoDetectBinPacking: false | ||
FixNamespaceComments: true | ||
ForEachMacros: | ||
- foreach | ||
- Q_FOREACH | ||
- BOOST_FOREACH | ||
IfMacros: | ||
- KJ_IF_MAYBE | ||
IncludeBlocks: Preserve | ||
IncludeCategories: | ||
- Regex: '^<ext/.*\.h>' | ||
Priority: 2 | ||
SortPriority: 0 | ||
CaseSensitive: false | ||
- Regex: '^<.*\.h>' | ||
Priority: 1 | ||
SortPriority: 0 | ||
CaseSensitive: false | ||
- Regex: '^<.*' | ||
Priority: 2 | ||
SortPriority: 0 | ||
CaseSensitive: false | ||
- Regex: '.*' | ||
Priority: 3 | ||
SortPriority: 0 | ||
CaseSensitive: false | ||
IncludeIsMainRegex: '([-_](test|unittest))?$' | ||
IncludeIsMainSourceRegex: '' | ||
IndentAccessModifiers: false | ||
IndentCaseLabels: true | ||
IndentCaseBlocks: false | ||
IndentGotoLabels: false | ||
IndentPPDirectives: None | ||
IndentExternBlock: AfterExternBlock | ||
IndentRequires: false | ||
IndentWidth: 4 | ||
IndentWrappedFunctionNames: false | ||
InsertTrailingCommas: None | ||
JavaScriptQuotes: Leave | ||
JavaScriptWrapImports: true | ||
KeepEmptyLinesAtTheStartOfBlocks: false | ||
LambdaBodyIndentation: Signature | ||
MacroBlockBegin: '' | ||
MacroBlockEnd: '' | ||
MaxEmptyLinesToKeep: 1 | ||
NamespaceIndentation: None | ||
ObjCBinPackProtocolList: Never | ||
ObjCBlockIndentWidth: 2 | ||
ObjCBreakBeforeNestedBlockParam: true | ||
ObjCSpaceAfterProperty: false | ||
ObjCSpaceBeforeProtocolList: true | ||
PenaltyBreakAssignment: 2 | ||
PenaltyBreakBeforeFirstCallParameter: 1 | ||
PenaltyBreakComment: 300 | ||
PenaltyBreakFirstLessLess: 120 | ||
PenaltyBreakString: 1000 | ||
PenaltyBreakTemplateDeclaration: 10 | ||
PenaltyExcessCharacter: 1000000 | ||
PenaltyReturnTypeOnItsOwnLine: 200 | ||
PenaltyIndentedWhitespace: 0 | ||
PointerAlignment: Left | ||
PPIndentWidth: -1 | ||
RawStringFormats: | ||
- Language: Cpp | ||
Delimiters: | ||
- cc | ||
- CC | ||
- cpp | ||
- Cpp | ||
- CPP | ||
- 'c++' | ||
- 'C++' | ||
CanonicalDelimiter: '' | ||
BasedOnStyle: google | ||
- Language: TextProto | ||
Delimiters: | ||
- pb | ||
- PB | ||
- proto | ||
- PROTO | ||
EnclosingFunctions: | ||
- EqualsProto | ||
- EquivToProto | ||
- PARSE_PARTIAL_TEXT_PROTO | ||
- PARSE_TEST_PROTO | ||
- PARSE_TEXT_PROTO | ||
- ParseTextOrDie | ||
- ParseTextProtoOrDie | ||
- ParseTestProto | ||
- ParsePartialTestProto | ||
CanonicalDelimiter: pb | ||
BasedOnStyle: google | ||
ReferenceAlignment: Pointer | ||
ReflowComments: true | ||
ShortNamespaceLines: 0 | ||
SortIncludes: CaseInsensitive | ||
SortIncludes: true | ||
SortJavaStaticImport: Before | ||
SortUsingDeclarations: true | ||
SpaceAfterCStyleCast: false | ||
SpaceAfterLogicalNot: false | ||
SpaceAfterTemplateKeyword: false | ||
SpaceBeforeAssignmentOperators: true | ||
SpaceBeforeCaseColon: false | ||
SpaceBeforeCpp11BracedList: false | ||
SpaceBeforeCtorInitializerColon: true | ||
SpaceBeforeInheritanceColon: true | ||
SpaceBeforeParens: ControlStatements | ||
SpaceAroundPointerQualifiers: Default | ||
SpaceBeforeRangeBasedForLoopColon: true | ||
SpaceInEmptyBlock: false | ||
SpaceInEmptyParentheses: false | ||
SpacesBeforeTrailingComments: 2 | ||
SpacesInAngles: Never | ||
SpacesInConditionalStatement: false | ||
SpacesInContainerLiterals: false | ||
SpacesInCStyleCastParentheses: false | ||
SpacesInLineCommentPrefix: | ||
Minimum: 1 | ||
Maximum: -1 | ||
SpacesInParentheses: false | ||
SpacesInSquareBrackets: false | ||
SpaceBeforeSquareBrackets: false | ||
BitFieldColonSpacing: Both | ||
Standard: Auto | ||
StatementAttributeLikeMacros: | ||
- Q_EMIT | ||
StatementMacros: | ||
- Q_UNUSED | ||
- QT_REQUIRE_VERSION | ||
TabWidth: 8 | ||
UseCRLF: false | ||
UseTab: Never | ||
WhitespaceSensitiveMacros: | ||
- STRINGIZE | ||
- PP_STRINGIZE | ||
- BOOST_PP_STRINGIZE | ||
- NS_SWIFT_NAME | ||
- CF_SWIFT_NAME | ||
... | ||
|
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 @@ | ||
.vscode/ | ||
.xmake/ | ||
build/ |
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,18 @@ | ||
[submodule "3rdparty/abseil-cpp"] | ||
path = 3rdparty/abseil-cpp | ||
url = [email protected]:abseil/abseil-cpp.git | ||
[submodule "3rdparty/CGraph"] | ||
path = 3rdparty/CGraph | ||
url = [email protected]:ChunelFeng/CGraph.git | ||
[submodule "3rdparty/eigen"] | ||
path = 3rdparty/eigen | ||
url = https://gitlab.com/libeigen/eigen.git | ||
[submodule "3rdparty/benchmark"] | ||
path = 3rdparty/benchmark | ||
url = [email protected]:google/benchmark.git | ||
[submodule "3rdparty/tmp"] | ||
path = 3rdparty/tmp | ||
url = [email protected]:zjhellofss/tmp.git | ||
[submodule "3rdparty/Catch2"] | ||
path = 3rdparty/Catch2 | ||
url = [email protected]:catchorg/Catch2.git |
Submodule abseil-cpp
added at
069776
Submodule eigen
added at
e88719
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,47 @@ | ||
-- 3rdparty libs | ||
-- set_languages("cxx20") | ||
|
||
target("abseil-log") | ||
set_kind("static") | ||
add_defines("ABSL_BUILD_DLL=1") | ||
add_defines("ABSL_CONSUME_DLL=1", "NOMINMAX", { public = true }) | ||
add_includedirs("abseil-cpp/", { public = true }) | ||
add_files("abseil-cpp/absl/log/*.cc|*_test.cc|*_benchmark.cc|*_mock_*.cc", | ||
"abseil-cpp/absl/log/internal/*.cc|*_test.cc|test_*.cc", | ||
"abseil-cpp/absl/strings/**.cc|**_test.cc|**_benchmark.cc", | ||
"abseil-cpp/absl/time/**.cc|**_test.cc|**_benchmark.cc", | ||
"abseil-cpp/absl/flags/**.cc|**_test.cc|**_benchmark.cc", | ||
"abseil-cpp/absl/container/**.cc|**_test.cc|**_benchmark.cc", | ||
"abseil-cpp/absl/synchronization/**.cc|**_test.cc|**_benchmark.cc", | ||
"abseil-cpp/absl/debugging/**.cc|**_test.cc|**_benchmark.cc", | ||
"abseil-cpp/absl/numeric/**.cc|**_test.cc|**_benchmark.cc", | ||
"abseil-cpp/absl/crc/**.cc|**_test.cc|**_benchmark.cc", | ||
"abseil-cpp/absl/hash/**.cc|**_test.cc|**_benchmark.cc", | ||
"abseil-cpp/absl/base/**.cc|**_test.cc|**_testing.cc|**_test_common.cc|**_benchmark.cc") | ||
|
||
target("cgraph") | ||
set_kind("static") | ||
add_includedirs("CGraph/src/", { public = true }) | ||
add_files("CGraph/src/**.cpp") | ||
|
||
target("eigen") | ||
set_kind("headeronly") | ||
add_includedirs("eigen/", { public = true }) | ||
add_headerfiles("eigen/unsupported/Eigen/CXX11/**.h") | ||
add_defines("EIGEN_USE_THREADS", { public = true }) | ||
|
||
target("catch2") | ||
set_kind("headeronly") | ||
add_includedirs("Catch2/single_include/", { public = true }) | ||
add_headerfiles("Catch2/single_include/catch2/catch.hpp") | ||
|
||
target("benchmark") | ||
set_kind("static") | ||
add_rules("mode.release", "mode.debug") | ||
add_includedirs("benchmark/include/", { public = true }) | ||
add_files("benchmark/src/**.cc") | ||
add_defines("BENCHMARK_STATIC_DEFINE", { public = true }) | ||
set_optimize("fastest") | ||
if is_plat("windows") then | ||
add_syslinks("shlwapi") | ||
end |
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 |
---|---|---|
@@ -1 +1,35 @@ | ||
# SimpleInfer | ||
# SimpleInfer | ||
|
||
SimpleInfer is a neural network inference framework based on [KuiperInfer](https://github.com/zjhellofss/KuiperInfer). | ||
|
||
## Build | ||
|
||
SimpleInfer uses [xmake](https://xmake.io/#/) to build library and tests. | ||
|
||
```shell | ||
git clone --recursive | ||
cd SimpleInfer | ||
xmake config -m release | ||
xmake | ||
``` | ||
## Run | ||
|
||
After building successfully, run test-engin to check. | ||
|
||
```shell | ||
xmake run test-engine | ||
``` | ||
|
||
## Reference | ||
|
||
[KuiperInfer](https://github.com/zjhellofss/KuiperInfer) -> basic framework | ||
|
||
[ncnn](https://github.com/Tencent/ncnn) -> pnnx ir, simpleocv and mat-pixel operations | ||
|
||
[Eigen](https://gitlab.com/libeigen/eigen), [tensorflow](https://github.com/tensorflow/tensorflow) -> Eigen tensor | ||
|
||
[abseil](https://github.com/abseil/abseil-cpp) -> logging, string format operations | ||
|
||
[CGraph](https://github.com/ChunelFeng/CGraph) -> graph based pipeline | ||
|
||
[benchmark](https://github.com/google/benchmark), [Catch2](https://github.com/catchorg/Catch2) -> benchmark and unit tests |
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,2 @@ | ||
#include <benchmark/benchmark.h> | ||
BENCHMARK_MAIN(); |
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,33 @@ | ||
#include <benchmark/benchmark.h> | ||
|
||
#include <string> | ||
|
||
#include "engine.h" | ||
|
||
static void BM_Yolov5s_Batch8_640x640(benchmark::State &state) { | ||
using namespace SimpleInfer; | ||
|
||
const std::string model_path(MODEL_PATH); | ||
const std::string param_file = | ||
model_path + "/yolo/demo/yolov5s_batch8.pnnx.param"; | ||
const std::string bin_file = | ||
model_path + "/yolo/demo/yolov5s_batch8.pnnx.bin"; | ||
|
||
InitializeContext(); | ||
|
||
Engine engine; | ||
engine.LoadModel(param_file, bin_file); | ||
|
||
Tensor input(SimpleInfer::DataType::kFloat32, {8, 640, 640, 3}, true); | ||
engine.Input("0", input); | ||
|
||
for (auto _ : state) { | ||
engine.Forward(); | ||
// benchmark::DoNotOptimize(_); | ||
} | ||
|
||
Tensor output; | ||
engine.Extract("140", output); | ||
} | ||
|
||
BENCHMARK(BM_Yolov5s_Batch8_640x640)->Unit(benchmark::kMillisecond); |
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.
Oops, something went wrong.