Initial commit to add all 3 custom projects
This commit is contained in:
15
.claude/settings.local.json
Normal file
15
.claude/settings.local.json
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"permissions": {
|
||||||
|
"allow": [
|
||||||
|
"Bash(find C:ProjectsANLSANSLIBANSCustomHelmetDetection -type f -name *)",
|
||||||
|
"mcp__desktop-commander__read_file",
|
||||||
|
"Bash(grep -E \"\\\\.\\(cpp|h|c|vcxproj|sln|props\\)$\")",
|
||||||
|
"Bash(find /c/Projects/CLionProjects/ANSCustomModels -name *.cmake -o -name CMakeLists.txt)",
|
||||||
|
"Bash(cp \"C:/Projects/ANLS/ANSLIB/ANSCustomFireNSmokeDetection/ANSCustomFireNSmoke.cpp\" \"C:/Projects/CLionProjects/ANSCustomModels/ANSCustomFireNSmokeDetection/ANSCustomFireNSmoke.cpp\")",
|
||||||
|
"Bash(cp \"C:/Projects/ANLS/ANSLIB/ANSCustomFireNSmokeDetection/dllmain.cpp\" \"C:/Projects/CLionProjects/ANSCustomModels/ANSCustomFireNSmokeDetection/dllmain.cpp\")",
|
||||||
|
"Bash(cp \"C:/Projects/ANLS/ANSLIB/ANSCustomFireNSmokeDetection/framework.h\" \"C:/Projects/CLionProjects/ANSCustomModels/ANSCustomFireNSmokeDetection/framework.h\")",
|
||||||
|
"Bash(cp \"C:/Projects/ANLS/ANSLIB/ANSCustomFireNSmokeDetection/pch.h\" \"C:/Projects/CLionProjects/ANSCustomModels/ANSCustomFireNSmokeDetection/pch.h\")",
|
||||||
|
"Bash(cp \"C:/Projects/ANLS/ANSLIB/ANSCustomFireNSmokeDetection/pch.cpp\" \"C:/Projects/CLionProjects/ANSCustomModels/ANSCustomFireNSmokeDetection/pch.cpp\")"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
10
.idea/.gitignore
generated
vendored
Normal file
10
.idea/.gitignore
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# Editor-based HTTP Client requests
|
||||||
|
/httpRequests/
|
||||||
|
# Ignored default folder with query files
|
||||||
|
/queries/
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
||||||
2
.idea/ANSCustomModels.iml
generated
Normal file
2
.idea/ANSCustomModels.iml
generated
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module classpath="CIDR" type="CPP_MODULE" version="4" />
|
||||||
249
.idea/editor.xml
generated
Normal file
249
.idea/editor.xml
generated
Normal file
@@ -0,0 +1,249 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="BackendCodeEditorSettings">
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CDeclarationWithImplicitIntType/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CommentTypo/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=ConstevalIfIsAlwaysConstant/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAbstractClassWithoutSpecifier/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAbstractFinalClass/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAbstractVirtualFunctionCallInCtor/@EntryIndexedValue" value="ERROR" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAccessSpecifierWithNoDeclarations/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAwaiterTypeIsNotClass/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBooleanIncrementExpression/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatBadCode/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatLegacyCode/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatMixedArgs/@EntryIndexedValue" value="ERROR" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatTooFewArgs/@EntryIndexedValue" value="ERROR" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatTooManyArgs/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppCStyleCast/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppCVQualifierCanNotBeAppliedToReference/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassCanBeFinal/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassIsIncomplete/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassNeedsConstructorBecauseOfUninitializedMember/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassNeverUsed/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppCompileTimeConstantCanBeReplacedWithBooleanConstant/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppConceptNeverUsed/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppConditionalExpressionCanBeSimplified/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppConstParameterInDeclaration/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppConstValueFunctionReturnType/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppCoroutineCallResolveError/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAArrayIndexOutOfBounds/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAConstantConditions/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAConstantFunctionResult/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAConstantParameter/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFADeletedPointer/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAEndlessLoop/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAInfiniteRecursion/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAInvalidatedMemory/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFALocalValueEscapesFunction/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFALocalValueEscapesScope/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFALoopConditionNotUpdated/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAMemoryLeak/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFANotInitializedField/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFANullDereference/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFATimeOver/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAUnreachableCode/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAUnreachableFunctionCall/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAUnreadVariable/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAUnusedValue/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclarationHidesLocal/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclarationHidesUncapturedLocal/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclarationSpecifierWithoutDeclarators/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclaratorDisambiguatedAsFunction/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclaratorNeverUsed/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclaratorUsedBeforeInitialization/@EntryIndexedValue" value="ERROR" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDefaultCaseNotHandledInSwitchStatement/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDefaultInitializationWithNoUserConstructor/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDefaultIsUsedAsIdentifier/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDefaultedSpecialMemberFunctionIsImplicitlyDeleted/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDefinitionsOrder/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeletingVoidPointer/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDependentTemplateWithoutTemplateKeyword/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDependentTypeWithoutTypenameKeyword/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeprecatedEntity/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeprecatedOverridenMethod/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeprecatedRegisterStorageClassSpecifier/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDereferenceOperatorLimitExceeded/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDiscardedPostfixOperatorResult/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDoxygenSyntaxError/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDoxygenUndocumentedParameter/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDoxygenUnresolvedReference/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEmptyDeclaration/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceCVQualifiersOrder/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceCVQualifiersPlacement/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceDoStatementBraces/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceForStatementBraces/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceFunctionDeclarationStyle/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceIfStatementBraces/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceNestedNamespacesStyle/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceOverridingDestructorStyle/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceOverridingFunctionStyle/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceTypeAliasCodeStyle/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceWhileStatementBraces/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEntityAssignedButNoRead/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEntityUsedOnlyInUnevaluatedContext/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnumeratorNeverUsed/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEqualOperandsInBinaryExpression/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEvaluationFailure/@EntryIndexedValue" value="ERROR" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppExplicitSpecializationInNonNamespaceScope/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppExpressionWithoutSideEffects/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFinalFunctionInFinalClass/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFinalNonOverridingVirtualFunction/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppForLoopCanBeReplacedWithWhile/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppForwardEnumDeclarationWithoutUnderlyingType/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFunctionDoesntReturnValue/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFunctionIsNotImplemented/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFunctionResultShouldBeUsed/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFunctionalStyleCast/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppHeaderHasBeenAlreadyIncluded/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppHiddenFunction/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppHidingFunction/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIdenticalOperandsInBinaryExpression/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIfCanBeReplacedByConstexprIf/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppImplicitDefaultConstructorNotAvailable/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIncompatiblePointerConversion/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIncompleteSwitchStatement/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppInconsistentNaming/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIntegralToPointerConversion/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppInvalidLineContinuation/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppJoinDeclarationAndAssignment/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLambdaCaptureNeverUsed/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLocalVariableMayBeConst/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLocalVariableMightNotBeInitialized/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLocalVariableWithNonTrivialDtorIsNeverUsed/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLongFloat/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMemberFunctionMayBeConst/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMemberFunctionMayBeStatic/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMemberInitializersOrder/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMismatchedClassTags/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMissingIncludeGuard/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMissingKeywordThrow/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppModulePartitionWithSeveralPartitionUnits/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtAddressOfClassRValue/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtBindingRValueToLvalueReference/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtCopyElisionInCopyInitDeclarator/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtDoubleUserConversionInCopyInit/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtNotInitializedStaticConstLocalVar/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtReinterpretCastFromNullptr/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMultiCharacterLiteral/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMultiCharacterWideLiteral/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMustBePublicVirtualToImplementInterface/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMutableSpecifierOnReferenceMember/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNoDiscardExpression/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNodiscardFunctionWithoutReturnValue/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonExceptionSafeResourceAcquisition/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonExplicitConversionOperator/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonExplicitConvertingConstructor/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonInlineFunctionDefinitionInHeaderFile/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonInlineVariableDefinitionInHeaderFile/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNotAllPathsReturnValue/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppObjectMemberMightNotBeInitialized/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppOutParameterMustBeWritten/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppParameterMayBeConst/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppParameterMayBeConstPtrOrRef/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppParameterNamesMismatch/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppParameterNeverUsed/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPassValueParameterByConstReference/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPointerConversionDropsQualifiers/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPointerToIntegralConversion/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPolymorphicClassWithNonVirtualPublicDestructor/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPossiblyErroneousEmptyStatements/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPossiblyUninitializedMember/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPossiblyUnintendedObjectSlicing/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrecompiledHeaderIsNotIncluded/@EntryIndexedValue" value="ERROR" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrecompiledHeaderNotFound/@EntryIndexedValue" value="ERROR" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrintfBadFormat/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrintfExtraArg/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrintfMissedArg/@EntryIndexedValue" value="ERROR" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrintfRiskyFormat/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrivateSpecialMemberFunctionIsNotImplemented/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRangeBasedForIncompatibleReference/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedefinitionOfDefaultArgumentInOverrideFunction/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantAccessSpecifier/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantBaseClassAccessSpecifier/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantBaseClassInitializer/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantBooleanExpressionArgument/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantCastExpression/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantComplexityInComparison/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantConditionalExpression/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantConstSpecifier/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantControlFlowJump/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantDereferencingAndTakingAddress/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantElaboratedTypeSpecifier/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantElseKeyword/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantElseKeywordInsideCompoundStatement/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantEmptyDeclaration/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantEmptyStatement/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantExportKeyword/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantFwdClassOrEnumSpecifier/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantInlineSpecifier/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantLambdaParameterList/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantMemberInitializer/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantNamespaceDefinition/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantParentheses/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantQualifier/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantQualifierADL/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantStaticSpecifierOnMemberAllocationFunction/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantStaticSpecifierOnThreadLocalLocalVariable/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantTemplateArguments/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantTemplateKeyword/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantTypenameKeyword/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantVoidArgumentList/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantZeroInitializerInAggregateInitialization/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppReinterpretCastFromVoidPtr/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRemoveRedundantBraces/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppReplaceMemsetWithZeroInitialization/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppReplaceTieWithStructuredBinding/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppReturnNoValueInNonVoidFunction/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppSmartPointerVsMakeFunction/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppSomeObjectMembersMightNotBeInitialized/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppSpecialFunctionWithoutNoexceptSpecification/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppStaticAssertFailure/@EntryIndexedValue" value="ERROR" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppStaticDataMemberInUnnamedStruct/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppStaticSpecifierOnAnonymousNamespaceMember/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppStringLiteralToCharPointerConversion/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTabsAreDisallowed/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTemplateArgumentsCanBeDeduced/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTemplateParameterNeverUsed/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTemplateParameterShadowing/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppThrowExpressionCanBeReplacedWithRethrow/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTooWideScope/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTooWideScopeInitStatement/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTypeAliasNeverUsed/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUninitializedDependentBaseClass/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUninitializedNonStaticDataMember/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnionMemberOfReferenceType/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnmatchedPragmaEndRegionDirective/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnmatchedPragmaRegionDirective/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnnamedNamespaceInHeaderFile/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnnecessaryWhitespace/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnsignedZeroComparison/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnusedIncludeDirective/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseAlgorithmWithCount/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseAssociativeContains/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseAuto/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseAutoForNumeric/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseElementsView/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseEraseAlgorithm/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseFamiliarTemplateSyntaxForGenericLambdas/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseRangeAlgorithm/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseStdSize/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseStructuredBinding/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseTypeTraitAlias/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUserDefinedLiteralSuffixDoesNotStartWithUnderscore/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUsingResultOfAssignmentAsCondition/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppVariableCanBeMadeConstexpr/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppVirtualFunctionCallInsideCtor/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppVirtualFunctionInFinalClass/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppVolatileParameterInDeclaration/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppWarningDirective/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppWrongIncludesOrder/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppWrongSlashesInIncludeDirective/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppZeroConstantCanBeReplacedWithNullptr/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppZeroValuedExpressionUsedAsNullPointer/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=IdentifierTypo/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=IfStdIsConstantEvaluatedCanBeReplaced/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=StdIsConstantEvaluatedWillAlwaysEvaluateToConstant/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=StringLiteralTypo/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
7
.idea/misc.xml
generated
Normal file
7
.idea/misc.xml
generated
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="CMakePythonSetting">
|
||||||
|
<option name="pythonIntegrationState" value="YES" />
|
||||||
|
</component>
|
||||||
|
<component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
|
||||||
|
</project>
|
||||||
8
.idea/modules.xml
generated
Normal file
8
.idea/modules.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/ANSCustomModels.iml" filepath="$PROJECT_DIR$/.idea/ANSCustomModels.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
1146
ANSCustomFireNSmokeDetection/ANSCustomFireNSmoke.cpp
Normal file
1146
ANSCustomFireNSmokeDetection/ANSCustomFireNSmoke.cpp
Normal file
File diff suppressed because it is too large
Load Diff
156
ANSCustomFireNSmokeDetection/ANSCustomFireNSmoke.h
Normal file
156
ANSCustomFireNSmokeDetection/ANSCustomFireNSmoke.h
Normal file
@@ -0,0 +1,156 @@
|
|||||||
|
#include "ANSLIB.h"
|
||||||
|
#include <deque>
|
||||||
|
#include <unordered_set>
|
||||||
|
|
||||||
|
#define RETAINFRAMES 80
|
||||||
|
#define FILTERFRAMES 10
|
||||||
|
//#define FNS_DEBUG
|
||||||
|
class CUSTOM_API ANSCustomFS : public IANSCustomClass
|
||||||
|
{
|
||||||
|
typedef std::pair<cv::Scalar, cv::Scalar> Range;
|
||||||
|
struct ImageSection {
|
||||||
|
cv::Rect region;
|
||||||
|
int priority;
|
||||||
|
ImageSection(const cv::Rect& r) : region(r), priority(0) {}
|
||||||
|
};
|
||||||
|
private:
|
||||||
|
using ANSLIBPtr = std::unique_ptr<ANSCENTER::ANSLIB, decltype(&ANSCENTER::ANSLIB::Destroy)>;
|
||||||
|
|
||||||
|
int engineType{ 0 };
|
||||||
|
ANSLIBPtr _motiondetector{ nullptr, &ANSCENTER::ANSLIB::Destroy };
|
||||||
|
ANSLIBPtr _detector{ nullptr, &ANSCENTER::ANSLIB::Destroy };
|
||||||
|
ANSLIBPtr _filter{ nullptr, &ANSCENTER::ANSLIB::Destroy };
|
||||||
|
|
||||||
|
std::recursive_mutex _mutex;
|
||||||
|
cv::Rect _detectedArea;
|
||||||
|
cv::Rect _previousDetectedArea;
|
||||||
|
int _retainDetectedArea{ 0 };
|
||||||
|
bool _isFireNSmokeDetected{ false };
|
||||||
|
float _detectionScoreThreshold{ 0.5 };
|
||||||
|
std::vector<cv::Mat> _frameHistory;
|
||||||
|
std::deque <cv::Mat> _frameQueue;
|
||||||
|
std::string _filterLabels;
|
||||||
|
int _realFireCheck{ 0 };
|
||||||
|
bool _isRealFireFrame{ false };
|
||||||
|
double _hsvThreshold;
|
||||||
|
std::vector<Range> _smoke_colour;
|
||||||
|
std::vector<Range> _fire_colour;
|
||||||
|
|
||||||
|
// ----- Model config -----
|
||||||
|
int _detectorModelType;
|
||||||
|
int _detectorDetectionType;
|
||||||
|
int _filterModelType;
|
||||||
|
int _filterDetectionType;
|
||||||
|
int _motionModelType;
|
||||||
|
int _motionDetectionType;
|
||||||
|
|
||||||
|
// Add these constants at class level
|
||||||
|
int MIN_ROI_SIZE = 50;
|
||||||
|
float SMOKE_CONFIDENCE_THRESHOLD = 0.7f;
|
||||||
|
float DETECTION_CONFIDENCE_THRESHOLD = 0.5f;
|
||||||
|
float MAX_AREA_OVERLAP = 0.5f;
|
||||||
|
int MAX_MOTION_TRACKING = 10;
|
||||||
|
int FILTER_VERIFICATION_FRAMES = 10;
|
||||||
|
int MIN_IMAGE_SIZE = 10;
|
||||||
|
float INCLUSIVE_IOU_THRESHOLD = 0.001f;
|
||||||
|
float MOTION_SENSITIVITY = 0.5f;
|
||||||
|
|
||||||
|
// Excluded filter class IDs
|
||||||
|
const std::unordered_set<int> EXCLUDED_FILTER_CLASSES =
|
||||||
|
{
|
||||||
|
13, // bench
|
||||||
|
59, // bed
|
||||||
|
60, // dining table
|
||||||
|
68, // microwave
|
||||||
|
69, // oven
|
||||||
|
70 // toaster
|
||||||
|
};
|
||||||
|
|
||||||
|
cv::Size previousImageSize = cv::Size(0, 0);
|
||||||
|
std::vector<ImageSection> cachedSections;
|
||||||
|
int _currentPriority{ 0 };
|
||||||
|
bool _readROIs{ false };
|
||||||
|
std::vector<cv::Rect> _exclusiveROIs;
|
||||||
|
float _smokeDetetectionThreshold{ 0 };
|
||||||
|
float _motionSpecificity{ 0 };
|
||||||
|
|
||||||
|
cv::Rect GenerateMinimumSquareBoundingBox(const std::vector<ANSCENTER::Object>& detectedObjects, int minSize = 640);
|
||||||
|
void UpdateNoDetectionCondition();
|
||||||
|
bool detectStaticFire(std::deque<cv::Mat>& frameQueue);
|
||||||
|
bool detectScreenFlicker(const std::vector<cv::Mat>& frames);
|
||||||
|
bool detectReflection(const cv::Mat& frame);
|
||||||
|
bool MajorityColourInFrame(cv::Mat frame, Range range, float area_threshold);
|
||||||
|
bool MajorityColourInFrame(cv::Mat frame, std::vector<Range> ranges, float area_threshold);
|
||||||
|
bool DetectFireNSmokeColourInFrame(const cv::Mat& frame, const cv::Rect& bBox, const std::vector<Range>& ranges, float area_threshold);
|
||||||
|
bool IsFireDetected(const cv::Mat image, const cv::Rect bBox);
|
||||||
|
bool IsSmokeDetected(const cv::Mat image, const cv::Rect bBox);
|
||||||
|
float calculateIoU(const cv::Rect& box1, const cv::Rect& box2);
|
||||||
|
bool IsOverlapping(const ANSCENTER::Object& obj, const std::vector<ANSCENTER::Object>& objectList, float iouThreshold = 0.5);
|
||||||
|
bool IsOverlapping(const ANSCENTER::Object& obj, const std::vector<cv::Rect>& objectList, float iouThreshold = 0.5);
|
||||||
|
|
||||||
|
bool IsROIOverlapping(const cv::Rect& obj, const std::vector<cv::Rect>& objectList, float iouThreshold = 0.5);
|
||||||
|
bool IsDetectedAreaValid(const cv::Rect& area) const;
|
||||||
|
bool IsFireOrSmoke(int classId, float confidence) const;
|
||||||
|
bool ValidateMotionCorrelation(const std::vector<cv::Rect>& fireNSmokeRects) const;
|
||||||
|
void UpdatePositiveDetection();
|
||||||
|
void ResetDetectedArea();
|
||||||
|
void UpdatePriorityRegion(const cv::Mat& frame);
|
||||||
|
int CalculateOptimalCropSize(const cv::Mat& frame) const;
|
||||||
|
void RefineDetectedArea(const cv::Mat& frame, const ANSCENTER::Object& detection);
|
||||||
|
std::vector<CustomObject> ConvertToCustomObjects(const std::vector<ANSCENTER::Object>& objects);
|
||||||
|
void ResetDetectionState();
|
||||||
|
void GetModelParameters();
|
||||||
|
std::vector<ANSCENTER::Object> ProcessExistingDetectedArea(const cv::Mat& frame, const std::string& camera_id, cv::Mat& draw);
|
||||||
|
bool ProcessValidDetection(const cv::Mat& frame, const std::string& camera_id, cv::Mat& draw, ANSCENTER::Object& detectedObj, std::vector<ANSCENTER::Object>& output);
|
||||||
|
void AddConfirmedDetection(ANSCENTER::Object& detectedObj, std::vector<ANSCENTER::Object>& output);
|
||||||
|
#ifdef FNS_DEBUG
|
||||||
|
void DisplayDebugFrame(cv::Mat& draw) {
|
||||||
|
cv::resize(draw, draw, cv::Size(1920, (1920 * draw.rows) / draw.cols));
|
||||||
|
cv::imshow("Combined Detected Areas", draw);
|
||||||
|
cv::waitKey(1);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
// Function to separate screen size
|
||||||
|
double calculateDistanceToCenter(const cv::Point& center, const cv::Rect& rect);
|
||||||
|
std::vector<ImageSection> divideImage(const cv::Mat& image);
|
||||||
|
int getHighestPriorityRegion();
|
||||||
|
int getLowestPriorityRegion();
|
||||||
|
cv::Rect getRegionByPriority(int priority);
|
||||||
|
|
||||||
|
std::vector<ANSCENTER::Object> ProcessExistingDetectedArea(
|
||||||
|
const cv::Mat& frame,
|
||||||
|
const std::string& camera_id,
|
||||||
|
const std::vector<cv::Rect>& fireNSmokeRects, cv::Mat& draw);
|
||||||
|
bool ProcessDetectedObject(
|
||||||
|
const cv::Mat& frame,
|
||||||
|
ANSCENTER::Object& detectedObj,
|
||||||
|
const std::string& camera_id,
|
||||||
|
const std::vector<cv::Rect>& fireNSmokeRects,
|
||||||
|
std::vector<ANSCENTER::Object>& output, cv::Mat& draw);
|
||||||
|
bool ValidateWithFilter(
|
||||||
|
const cv::Mat& frame,
|
||||||
|
const ANSCENTER::Object& detectedObj,
|
||||||
|
const std::string& camera_id,
|
||||||
|
std::vector<ANSCENTER::Object>& output, cv::Mat& draw);
|
||||||
|
std::vector<ANSCENTER::Object> FindNewDetectedArea(
|
||||||
|
const cv::Mat& frame,
|
||||||
|
const std::string& camera_id, cv::Mat& draw);
|
||||||
|
|
||||||
|
std::vector<ANSCENTER::Object> FindMovementObjects(
|
||||||
|
const cv::Mat& frame,
|
||||||
|
const std::string& camera_id, cv::Mat& draw);
|
||||||
|
|
||||||
|
std::vector<ANSCENTER::Object> FindExcludedObjects(
|
||||||
|
const cv::Mat& frame,
|
||||||
|
const std::string& camera_id, cv::Mat& draw);
|
||||||
|
|
||||||
|
public:
|
||||||
|
bool Initialize(const std::string& modelDiretory, float detectionScoreThreshold, std::string& labelMap) override;
|
||||||
|
bool OptimizeModel(bool fp16) override;
|
||||||
|
bool ConfigureParameters(CustomParams& param) override;
|
||||||
|
std::vector<CustomObject> RunInference(const cv::Mat& input) override;
|
||||||
|
std::vector<CustomObject> RunInference(const cv::Mat& input, const std::string& camera_id) override;
|
||||||
|
bool Destroy() override;
|
||||||
|
ANSCustomFS();
|
||||||
|
~ANSCustomFS();
|
||||||
|
};
|
||||||
60
ANSCustomFireNSmokeDetection/CMakeLists.txt
Normal file
60
ANSCustomFireNSmokeDetection/CMakeLists.txt
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
project(ANSCustomFireNSmokeDetection LANGUAGES CXX)
|
||||||
|
|
||||||
|
# ---------- sources ----------
|
||||||
|
set(SOURCES
|
||||||
|
ANSCustomFireNSmoke.cpp
|
||||||
|
dllmain.cpp
|
||||||
|
pch.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
set(HEADERS
|
||||||
|
ANSCustomFireNSmoke.h
|
||||||
|
framework.h
|
||||||
|
pch.h
|
||||||
|
)
|
||||||
|
|
||||||
|
# ---------- shared library (DLL) ----------
|
||||||
|
add_library(${PROJECT_NAME} SHARED ${SOURCES} ${HEADERS})
|
||||||
|
|
||||||
|
# ---------- preprocessor definitions ----------
|
||||||
|
target_compile_definitions(${PROJECT_NAME} PRIVATE
|
||||||
|
ANSCUSTOMFIRENSMOKE_EXPORTS
|
||||||
|
_WINDOWS
|
||||||
|
_USRDLL
|
||||||
|
WIN32_LEAN_AND_MEAN
|
||||||
|
NOMINMAX
|
||||||
|
$<$<CONFIG:Debug>:_DEBUG>
|
||||||
|
$<$<CONFIG:Release>:NDEBUG>
|
||||||
|
)
|
||||||
|
|
||||||
|
# ---------- include directories ----------
|
||||||
|
target_include_directories(${PROJECT_NAME} PRIVATE
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
C:/Projects/ANLS/ANSLIB/ANSLIB
|
||||||
|
C:/ANSLibs/opencv/include
|
||||||
|
)
|
||||||
|
|
||||||
|
# ---------- library directories & linking ----------
|
||||||
|
target_link_directories(${PROJECT_NAME} PRIVATE
|
||||||
|
C:/ProgramData/ANSCENTER/Shared
|
||||||
|
C:/ANSLibs/opencv/x64/vc17/lib
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(${PROJECT_NAME} PRIVATE
|
||||||
|
ANSLIB
|
||||||
|
opencv_world4130
|
||||||
|
)
|
||||||
|
|
||||||
|
# ---------- compiler options (MSVC) ----------
|
||||||
|
if(MSVC)
|
||||||
|
target_compile_options(${PROJECT_NAME} PRIVATE
|
||||||
|
/W3 # Warning level 3
|
||||||
|
/sdl # SDL checks
|
||||||
|
/permissive- # Conformance mode
|
||||||
|
$<$<CONFIG:Release>:/O2 /Oi /GL> # Optimize + intrinsics + whole-program opt
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_options(${PROJECT_NAME} PRIVATE
|
||||||
|
$<$<CONFIG:Release>:/OPT:REF /OPT:ICF /LTCG> # Optimize refs, COMDAT folding, link-time codegen
|
||||||
|
)
|
||||||
|
endif()
|
||||||
23
ANSCustomFireNSmokeDetection/dllmain.cpp
Normal file
23
ANSCustomFireNSmokeDetection/dllmain.cpp
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
// dllmain.cpp : Defines the entry point for the DLL application.
|
||||||
|
#include "pch.h"
|
||||||
|
#include "ANSCustomFireNSmoke.h"
|
||||||
|
BOOL APIENTRY DllMain( HMODULE hModule,
|
||||||
|
DWORD ul_reason_for_call,
|
||||||
|
LPVOID lpReserved
|
||||||
|
)
|
||||||
|
{
|
||||||
|
switch (ul_reason_for_call)
|
||||||
|
{
|
||||||
|
case DLL_PROCESS_ATTACH:
|
||||||
|
case DLL_THREAD_ATTACH:
|
||||||
|
case DLL_THREAD_DETACH:
|
||||||
|
case DLL_PROCESS_DETACH:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// expose the class to the outside world
|
||||||
|
extern "C" __declspec(dllexport) IANSCustomClass* Create() {
|
||||||
|
return new ANSCustomFS();
|
||||||
|
}
|
||||||
7
ANSCustomFireNSmokeDetection/framework.h
Normal file
7
ANSCustomFireNSmokeDetection/framework.h
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||||
|
#define NOMINMAX // Prevent windows.h from defining min/max macros
|
||||||
|
// which break std::min / std::max (C2589)
|
||||||
|
// Windows Header Files
|
||||||
|
#include <windows.h>
|
||||||
5
ANSCustomFireNSmokeDetection/pch.cpp
Normal file
5
ANSCustomFireNSmokeDetection/pch.cpp
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
// pch.cpp: source file corresponding to the pre-compiled header
|
||||||
|
|
||||||
|
#include "pch.h"
|
||||||
|
|
||||||
|
// When you are using pre-compiled headers, this source file is necessary for compilation to succeed.
|
||||||
13
ANSCustomFireNSmokeDetection/pch.h
Normal file
13
ANSCustomFireNSmokeDetection/pch.h
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
// pch.h: This is a precompiled header file.
|
||||||
|
// Files listed below are compiled only once, improving build performance for future builds.
|
||||||
|
// This also affects IntelliSense performance, including code completion and many code browsing features.
|
||||||
|
// However, files listed here are ALL re-compiled if any one of them is updated between builds.
|
||||||
|
// Do not add files here that you will be updating frequently as this negates the performance advantage.
|
||||||
|
|
||||||
|
#ifndef PCH_H
|
||||||
|
#define PCH_H
|
||||||
|
|
||||||
|
// add headers that you want to pre-compile here
|
||||||
|
#include "framework.h"
|
||||||
|
|
||||||
|
#endif //PCH_H
|
||||||
257
ANSCustomHelmetDetection/ANSCustomCodeHelmetDetection.cpp
Normal file
257
ANSCustomHelmetDetection/ANSCustomCodeHelmetDetection.cpp
Normal file
@@ -0,0 +1,257 @@
|
|||||||
|
#include "ANSCustomCodeHelmetDetection.h"
|
||||||
|
|
||||||
|
static std::string toUpperCase(const std::string& input) {
|
||||||
|
std::string result = input;
|
||||||
|
std::transform(result.begin(), result.end(), result.begin(),
|
||||||
|
[](unsigned char c) { return std::toupper(c); });
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
ANSCustomHMD::ANSCustomHMD() {
|
||||||
|
_isInitialized = false;
|
||||||
|
_readROIs = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
ANSCustomHMD::~ANSCustomHMD() {
|
||||||
|
Destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ANSCustomHMD::Destroy() {
|
||||||
|
try {
|
||||||
|
_detector.reset();
|
||||||
|
_classifier.reset();
|
||||||
|
_isInitialized = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (...) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ANSCustomHMD::OptimizeModel(bool fp16) {
|
||||||
|
try {
|
||||||
|
if (!_detector || !_classifier) return false;
|
||||||
|
int detectorResult = _detector->Optimize(fp16);
|
||||||
|
int classifierResult = _classifier->Optimize(fp16);
|
||||||
|
if ((detectorResult != 1) || (classifierResult != 1)) return false;
|
||||||
|
else return true;
|
||||||
|
}
|
||||||
|
catch (...) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ANSCustomHMD::Initialize(const std::string& modelDirectory, float detectionScoreThreshold, std::string& labelMap) {
|
||||||
|
try {
|
||||||
|
_modelDirectory = modelDirectory;
|
||||||
|
_detectionScoreThreshold = detectionScoreThreshold;
|
||||||
|
_isInitialized = false;
|
||||||
|
|
||||||
|
// Create model instances using factory pattern (ABI-safe)
|
||||||
|
_detector = ANSLIBPtr(ANSCENTER::ANSLIB::Create(), &ANSCENTER::ANSLIB::Destroy);
|
||||||
|
_classifier = ANSLIBPtr(ANSCENTER::ANSLIB::Create(), &ANSCENTER::ANSLIB::Destroy);
|
||||||
|
|
||||||
|
// NVIDIA GPU: Use TensorRT
|
||||||
|
_detectorModelType = 31; // TENSORRT
|
||||||
|
_detectorDetectionType = 1; // DETECTION
|
||||||
|
_classifierModelType = 31; // TENSORRT
|
||||||
|
_classifierDetectionType = 0; // CLASSIFICATION
|
||||||
|
|
||||||
|
//Check the hardware type
|
||||||
|
engineType = _detector->GetEngineType();
|
||||||
|
if (engineType == 1) {
|
||||||
|
// NVIDIA GPU: Use TensorRT
|
||||||
|
_detectorModelType = 31; // TENSORRT
|
||||||
|
_detectorDetectionType = 1; // DETECTION
|
||||||
|
_classifierModelType = 31; // TENSORRT
|
||||||
|
_classifierDetectionType = 0; // CLASSIFICATION
|
||||||
|
std::cout << "NVIDIA GPU detected. Using TensorRT" << std::endl;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// CPU/Other: Use YOLO
|
||||||
|
_detectorModelType = 3; // YOLOV8/YOLOV11
|
||||||
|
_detectorDetectionType = 1; // DETECTION
|
||||||
|
_classifierModelType = 20; // ANSONNXCL
|
||||||
|
_classifierDetectionType = 0; // CLASSIFICATION
|
||||||
|
std::cout << "CPU detected. Using YOLO/ANSONNXCL" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_detectionScoreThreshold < 0.25f) _detectionScoreThreshold = 0.25f;
|
||||||
|
|
||||||
|
// classId: 0=license plate, 1=motorcyclist, 2=helmet, 3=no_helmet
|
||||||
|
labelMap = "license plate,motorcyclist,helmet,no_helmet";
|
||||||
|
|
||||||
|
#ifdef FNS_DEBUG
|
||||||
|
this->_loadEngineOnCreate = true;
|
||||||
|
#endif
|
||||||
|
int loadEngineOnCreation = _loadEngineOnCreate ? 1 : 0;
|
||||||
|
int autoEngineDetection = 1;
|
||||||
|
std::string licenseKey = "";
|
||||||
|
|
||||||
|
// Load detector model
|
||||||
|
float detScoreThreshold = _detectionScoreThreshold;
|
||||||
|
float detConfThreshold = 0.5f;
|
||||||
|
float detNMSThreshold = 0.5f;
|
||||||
|
std::string detLabelMap;
|
||||||
|
int detResult = _detector->LoadModelFromFolder(
|
||||||
|
licenseKey.c_str(),
|
||||||
|
"detector", "detector.names",
|
||||||
|
detScoreThreshold, detConfThreshold, detNMSThreshold,
|
||||||
|
autoEngineDetection,
|
||||||
|
_detectorModelType, _detectorDetectionType,
|
||||||
|
loadEngineOnCreation,
|
||||||
|
modelDirectory.c_str(),
|
||||||
|
detLabelMap);
|
||||||
|
if (detResult != 1) {
|
||||||
|
std::cerr << "ANSCustomHMD::Initialize: Failed to load detector model." << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load classifier model
|
||||||
|
float clsScoreThreshold = 0.25f;
|
||||||
|
float clsConfThreshold = 0.5f;
|
||||||
|
float clsNMSThreshold = 0.5f;
|
||||||
|
int clsResult = _classifier->LoadModelFromFolder(
|
||||||
|
licenseKey.c_str(),
|
||||||
|
"classifier", "classifier.names",
|
||||||
|
clsScoreThreshold, clsConfThreshold, clsNMSThreshold,
|
||||||
|
autoEngineDetection,
|
||||||
|
_classifierModelType, _classifierDetectionType,
|
||||||
|
loadEngineOnCreation,
|
||||||
|
modelDirectory.c_str(),
|
||||||
|
_classifierLabels);
|
||||||
|
if (clsResult != 1) {
|
||||||
|
std::cerr << "ANSCustomHMD::Initialize: Failed to load classifier model." << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
_isInitialized = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (const std::exception& e) {
|
||||||
|
std::cerr << "ANSCustomHMD::Initialize: Exception: " << e.what() << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
catch (...) {
|
||||||
|
std::cerr << "ANSCustomHMD::Initialize: Unknown exception." << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ANSCustomHMD::ConfigureParameters(CustomParams& param) {
|
||||||
|
param.ROI_Config.clear();
|
||||||
|
param.ROI_Options.clear();
|
||||||
|
param.Parameters.clear();
|
||||||
|
param.ROI_Values.clear();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<CustomObject> ANSCustomHMD::RunInference(const cv::Mat& input) {
|
||||||
|
return RunInference(input, "CustomCam");
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<CustomObject> ANSCustomHMD::RunInference(const cv::Mat& input, const std::string& camera_id) {
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(_mutex);
|
||||||
|
|
||||||
|
if (!_isInitialized || !_detector) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (input.empty() || input.cols < 10 || input.rows < 10) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
// One-time parameter reading
|
||||||
|
if (!_readROIs) {
|
||||||
|
for (const auto& param : _params.Parameters) {
|
||||||
|
if (param.Name.find("ALPR") != std::string::npos) {
|
||||||
|
std::string paramValue = toUpperCase(param.Value);
|
||||||
|
// ALPR feature currently disabled
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_readROIs = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Run object detection
|
||||||
|
std::vector<ANSCENTER::Object> detectionResults;
|
||||||
|
_detector->RunInference(input, camera_id.c_str(), detectionResults);
|
||||||
|
|
||||||
|
if (detectionResults.empty()) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<CustomObject> results;
|
||||||
|
results.reserve(detectionResults.size());
|
||||||
|
|
||||||
|
const cv::Rect frameBounds(0, 0, input.cols, input.rows);
|
||||||
|
const float scoreThreshold = _detectionScoreThreshold;
|
||||||
|
|
||||||
|
for (const auto& obj : detectionResults) {
|
||||||
|
if (obj.confidence < scoreThreshold) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
CustomObject customObject;
|
||||||
|
customObject.confidence = obj.confidence;
|
||||||
|
customObject.box = obj.box;
|
||||||
|
customObject.cameraId = camera_id;
|
||||||
|
|
||||||
|
switch (obj.classId) {
|
||||||
|
case 0: { // License plate
|
||||||
|
customObject.classId = 0;
|
||||||
|
customObject.className = "license plate";
|
||||||
|
customObject.extraInfo = "license plate";
|
||||||
|
results.push_back(std::move(customObject));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 1: { // Motorcycle
|
||||||
|
customObject.classId = 1;
|
||||||
|
customObject.className = "motorcyclist";
|
||||||
|
results.push_back(std::move(customObject));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 2: // Helmet
|
||||||
|
case 3: { // No helmet - classify to confirm
|
||||||
|
// Validate bounding box
|
||||||
|
if ((obj.box & frameBounds) != obj.box) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_classifier) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
cv::Mat croppedImage = input(obj.box);
|
||||||
|
std::vector<ANSCENTER::Object> classifierResults;
|
||||||
|
_classifier->RunInference(croppedImage, camera_id.c_str(), classifierResults);
|
||||||
|
|
||||||
|
if (classifierResults.empty()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const bool isNoHelmet = (classifierResults[0].classId == 1);
|
||||||
|
customObject.classId = isNoHelmet ? 3 : 2;
|
||||||
|
customObject.className = isNoHelmet ? "no_helmet" : "helmet";
|
||||||
|
results.push_back(std::move(customObject));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
catch (const std::exception& e) {
|
||||||
|
std::cerr << "ANSCustomHMD::RunInference: Exception: " << e.what() << std::endl;
|
||||||
|
}
|
||||||
|
catch (...) {
|
||||||
|
std::cerr << "ANSCustomHMD::RunInference: Unknown exception." << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
return {};
|
||||||
|
}
|
||||||
33
ANSCustomHelmetDetection/ANSCustomCodeHelmetDetection.h
Normal file
33
ANSCustomHelmetDetection/ANSCustomCodeHelmetDetection.h
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
#include "ANSLIB.h"
|
||||||
|
|
||||||
|
//#define FNS_DEBUG
|
||||||
|
class CUSTOM_API ANSCustomHMD : public IANSCustomClass
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
using ANSLIBPtr = std::unique_ptr<ANSCENTER::ANSLIB, decltype(&ANSCENTER::ANSLIB::Destroy)>;
|
||||||
|
|
||||||
|
std::recursive_mutex _mutex;
|
||||||
|
int engineType{ 0 };
|
||||||
|
ANSLIBPtr _detector{ nullptr, &ANSCENTER::ANSLIB::Destroy };
|
||||||
|
ANSLIBPtr _classifier{ nullptr, &ANSCENTER::ANSLIB::Destroy };
|
||||||
|
|
||||||
|
// ----- Model config -----
|
||||||
|
int _detectorModelType;
|
||||||
|
int _detectorDetectionType;
|
||||||
|
int _classifierModelType;
|
||||||
|
int _classifierDetectionType;
|
||||||
|
|
||||||
|
std::string _classifierLabels;
|
||||||
|
bool _isInitialized{ false };
|
||||||
|
bool _readROIs{ false };
|
||||||
|
|
||||||
|
public:
|
||||||
|
bool Initialize(const std::string& modelDiretory, float detectionScoreThreshold, std::string& labelMap) override;
|
||||||
|
bool OptimizeModel(bool fp16) override;
|
||||||
|
bool ConfigureParameters(CustomParams& param) override;
|
||||||
|
std::vector<CustomObject> RunInference(const cv::Mat& input) override;
|
||||||
|
std::vector<CustomObject> RunInference(const cv::Mat& input, const std::string& camera_id) override;
|
||||||
|
bool Destroy() override;
|
||||||
|
ANSCustomHMD();
|
||||||
|
~ANSCustomHMD();
|
||||||
|
};
|
||||||
60
ANSCustomHelmetDetection/CMakeLists.txt
Normal file
60
ANSCustomHelmetDetection/CMakeLists.txt
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
project(ANSCustomHelmetDetection LANGUAGES CXX)
|
||||||
|
|
||||||
|
# ---------- sources ----------
|
||||||
|
set(SOURCES
|
||||||
|
ANSCustomCodeHelmetDetection.cpp
|
||||||
|
dllmain.cpp
|
||||||
|
pch.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
set(HEADERS
|
||||||
|
ANSCustomCodeHelmetDetection.h
|
||||||
|
framework.h
|
||||||
|
pch.h
|
||||||
|
)
|
||||||
|
|
||||||
|
# ---------- shared library (DLL) ----------
|
||||||
|
add_library(${PROJECT_NAME} SHARED ${SOURCES} ${HEADERS})
|
||||||
|
|
||||||
|
# ---------- preprocessor definitions ----------
|
||||||
|
target_compile_definitions(${PROJECT_NAME} PRIVATE
|
||||||
|
ANSCUSTOMHELMETDETECTION_EXPORTS
|
||||||
|
_WINDOWS
|
||||||
|
_USRDLL
|
||||||
|
WIN32_LEAN_AND_MEAN
|
||||||
|
NOMINMAX
|
||||||
|
$<$<CONFIG:Debug>:_DEBUG>
|
||||||
|
$<$<CONFIG:Release>:NDEBUG>
|
||||||
|
)
|
||||||
|
|
||||||
|
# ---------- include directories ----------
|
||||||
|
target_include_directories(${PROJECT_NAME} PRIVATE
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
C:/Projects/ANLS/ANSLIB/ANSLIB
|
||||||
|
C:/ANSLibs/opencv/include
|
||||||
|
)
|
||||||
|
|
||||||
|
# ---------- library directories & linking ----------
|
||||||
|
target_link_directories(${PROJECT_NAME} PRIVATE
|
||||||
|
C:/ProgramData/ANSCENTER/Shared
|
||||||
|
C:/ANSLibs/opencv/x64/vc17/lib
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(${PROJECT_NAME} PRIVATE
|
||||||
|
ANSLIB
|
||||||
|
opencv_world4130
|
||||||
|
)
|
||||||
|
|
||||||
|
# ---------- compiler options (MSVC) ----------
|
||||||
|
if(MSVC)
|
||||||
|
target_compile_options(${PROJECT_NAME} PRIVATE
|
||||||
|
/W3 # Warning level 3
|
||||||
|
/sdl # SDL checks
|
||||||
|
/permissive- # Conformance mode
|
||||||
|
$<$<CONFIG:Release>:/O2 /Oi /GL> # Optimize + intrinsics + whole-program opt
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_options(${PROJECT_NAME} PRIVATE
|
||||||
|
$<$<CONFIG:Release>:/OPT:REF /OPT:ICF /LTCG> # Optimize refs, COMDAT folding, link-time codegen
|
||||||
|
)
|
||||||
|
endif()
|
||||||
23
ANSCustomHelmetDetection/dllmain.cpp
Normal file
23
ANSCustomHelmetDetection/dllmain.cpp
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
// dllmain.cpp : Defines the entry point for the DLL application.
|
||||||
|
#include "pch.h"
|
||||||
|
#include "ANSCustomCodeHelmetDetection.h"
|
||||||
|
BOOL APIENTRY DllMain( HMODULE hModule,
|
||||||
|
DWORD ul_reason_for_call,
|
||||||
|
LPVOID lpReserved
|
||||||
|
)
|
||||||
|
{
|
||||||
|
switch (ul_reason_for_call)
|
||||||
|
{
|
||||||
|
case DLL_PROCESS_ATTACH:
|
||||||
|
case DLL_THREAD_ATTACH:
|
||||||
|
case DLL_THREAD_DETACH:
|
||||||
|
case DLL_PROCESS_DETACH:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// expose the class to the outside world
|
||||||
|
extern "C" __declspec(dllexport) IANSCustomClass* Create() {
|
||||||
|
return new ANSCustomHMD();
|
||||||
|
}
|
||||||
7
ANSCustomHelmetDetection/framework.h
Normal file
7
ANSCustomHelmetDetection/framework.h
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||||
|
#define NOMINMAX // Prevent windows.h from defining min/max macros
|
||||||
|
// which break std::min / std::max (C2589)
|
||||||
|
// Windows Header Files
|
||||||
|
#include <windows.h>
|
||||||
5
ANSCustomHelmetDetection/pch.cpp
Normal file
5
ANSCustomHelmetDetection/pch.cpp
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
// pch.cpp: source file corresponding to the pre-compiled header
|
||||||
|
|
||||||
|
#include "pch.h"
|
||||||
|
|
||||||
|
// When you are using pre-compiled headers, this source file is necessary for compilation to succeed.
|
||||||
13
ANSCustomHelmetDetection/pch.h
Normal file
13
ANSCustomHelmetDetection/pch.h
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
// pch.h: This is a precompiled header file.
|
||||||
|
// Files listed below are compiled only once, improving build performance for future builds.
|
||||||
|
// This also affects IntelliSense performance, including code completion and many code browsing features.
|
||||||
|
// However, files listed here are ALL re-compiled if any one of them is updated between builds.
|
||||||
|
// Do not add files here that you will be updating frequently as this negates the performance advantage.
|
||||||
|
|
||||||
|
#ifndef PCH_H
|
||||||
|
#define PCH_H
|
||||||
|
|
||||||
|
// add headers that you want to pre-compile here
|
||||||
|
#include "framework.h"
|
||||||
|
|
||||||
|
#endif //PCH_H
|
||||||
810
ANSCustomWeaponDetection/ANSCustomCodeWeaponDetection.cpp
Normal file
810
ANSCustomWeaponDetection/ANSCustomCodeWeaponDetection.cpp
Normal file
@@ -0,0 +1,810 @@
|
|||||||
|
#include "ANSCustomCodeWeaponDetection.h"
|
||||||
|
|
||||||
|
//#define FNS_DEBUG
|
||||||
|
ANSCustomWD::ANSCustomWD()
|
||||||
|
{
|
||||||
|
// Initialize the model
|
||||||
|
}
|
||||||
|
bool ANSCustomWD::OptimizeModel(bool fp16)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
if (this->_detector == nullptr || this->_filter == nullptr)
|
||||||
|
{
|
||||||
|
std::cout << "Model is not initialized." << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
int vResult = _detector->Optimize(fp16);
|
||||||
|
int tResult = _filter->Optimize(fp16);
|
||||||
|
if (vResult != 1 || tResult != 1)
|
||||||
|
{
|
||||||
|
std::cout << "Model optimization failed." << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
std::cout << "Model optimization successful." << std::endl;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (const std::exception& e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
catch (...) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<CustomObject> ANSCustomWD::RunInference(const cv::Mat& input)
|
||||||
|
{
|
||||||
|
return RunInference(input, "CustomCam");
|
||||||
|
}
|
||||||
|
bool ANSCustomWD::Destroy()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
this->_detector.reset();
|
||||||
|
this->_filter.reset();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (const std::exception& e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
catch (...) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
bool ANSCustomWD::Initialize(const std::string& modelDirectory, float detectionScoreThreshold, std::string& labelMap)
|
||||||
|
{
|
||||||
|
//1. The modelDirectory is supplied by ANSVIS and contains the path to the model files
|
||||||
|
_modelDirectory = modelDirectory;
|
||||||
|
_detectionScoreThreshold = detectionScoreThreshold;
|
||||||
|
|
||||||
|
// Detector model configuration
|
||||||
|
_detectorModelName = "train_last";
|
||||||
|
_detectorClassName = "classes.names";
|
||||||
|
_detectorModelType = 4; // Assuming 4 represents TensorRT YoloV11
|
||||||
|
_detectorDetectionType = 1; // Assuming 1 represents object detection
|
||||||
|
|
||||||
|
// Fileter model configuration
|
||||||
|
_filterModelName = "filter";
|
||||||
|
_filterClassName = "filter.names";
|
||||||
|
_filterModelType = 4; // Assuming 4 represents TensorRT YoloV11
|
||||||
|
_filterDetectionType = 1; // Assuming 1 represents object detection
|
||||||
|
|
||||||
|
// Create model instances
|
||||||
|
_detector = ANSLIBPtr(ANSCENTER::ANSLIB::Create(), &ANSCENTER::ANSLIB::Destroy);
|
||||||
|
_filter = ANSLIBPtr(ANSCENTER::ANSLIB::Create(), &ANSCENTER::ANSLIB::Destroy);
|
||||||
|
|
||||||
|
_detectorModelType = 4; // Assuming 4 represents TensorRT YoloV11
|
||||||
|
_detectorDetectionType = 1; // Assuming 1 represents object detection
|
||||||
|
_filterModelType = 4; // Assuming 4 represents TensorRT YoloV12
|
||||||
|
_filterDetectionType = 1; // Assuming 1 represents object detection
|
||||||
|
|
||||||
|
// Check the hardware type
|
||||||
|
engineType = _detector->GetEngineType();
|
||||||
|
if (engineType == 1) {
|
||||||
|
// detector will be TensorRT (v8, v11) and filter will be TensorRT (v12)
|
||||||
|
_detectorModelType = 4; // Assuming 4 represents TensorRT YoloV11
|
||||||
|
_detectorDetectionType = 1; // Assuming 1 represents object detection
|
||||||
|
_filterModelType = 4; // Assuming 4 represents TensorRT YoloV12
|
||||||
|
_filterDetectionType = 1; // Assuming 1 represents object detection
|
||||||
|
std::cout << "NVIDIA GPU detected. Using TensorRT" << std::endl;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// detetector will be OpenVINO (v8, v11) and filter will be Yolo (v12)
|
||||||
|
_detectorModelType = 5; // Assuming 5 represents OpenVINO YoloV11
|
||||||
|
_detectorDetectionType = 1; // Assuming 1 represents object detection
|
||||||
|
_filterModelType = 17; // Assuming 17 represents ONNX YoloV12
|
||||||
|
_filterDetectionType = 1; // Assuming 1 represents object detection
|
||||||
|
std::cout << "CPU detected. Using OpenVINO and ONNX" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Clear parameters
|
||||||
|
this->_params.ROI_Config.clear();
|
||||||
|
this->_params.ROI_Options.clear();
|
||||||
|
this->_params.Parameters.clear();
|
||||||
|
this->_params.ROI_Values.clear();
|
||||||
|
|
||||||
|
|
||||||
|
//2. User can start impelementing the initialization logic here
|
||||||
|
|
||||||
|
double _modelConfThreshold = 0.5;
|
||||||
|
double _modelNMSThreshold = 0.5;
|
||||||
|
std::string licenseKey = "";
|
||||||
|
#ifdef FNS_DEBUG // Corrected preprocessor directive
|
||||||
|
_loadEngineOnCreate = true;
|
||||||
|
#endif
|
||||||
|
int loadEngineOnCreation = 0; // Load engine on creation
|
||||||
|
if (_loadEngineOnCreate)loadEngineOnCreation = 1;
|
||||||
|
int autoEngineDetection = 1; // Auto engine detection
|
||||||
|
int detectorResult = _detector->LoadModelFromFolder(licenseKey.c_str(),
|
||||||
|
_detectorModelName.c_str(),
|
||||||
|
_detectorClassName.c_str(),
|
||||||
|
detectionScoreThreshold,
|
||||||
|
_modelConfThreshold,
|
||||||
|
_modelNMSThreshold, autoEngineDetection,
|
||||||
|
_detectorModelType,
|
||||||
|
_detectorDetectionType,
|
||||||
|
loadEngineOnCreation,
|
||||||
|
_modelDirectory.c_str(),
|
||||||
|
labelMap);
|
||||||
|
|
||||||
|
int filterResult = _filter->LoadModelFromFolder(licenseKey.c_str(),
|
||||||
|
_filterModelName.c_str(),
|
||||||
|
_filterClassName.c_str(),
|
||||||
|
_detectionScoreThreshold,
|
||||||
|
_modelConfThreshold,
|
||||||
|
_modelNMSThreshold, autoEngineDetection,
|
||||||
|
_filterModelType,
|
||||||
|
_filterDetectionType,
|
||||||
|
loadEngineOnCreation,
|
||||||
|
_modelDirectory.c_str(),
|
||||||
|
_filterLabelMap);
|
||||||
|
|
||||||
|
if ((detectorResult == 1) && (filterResult == 1)) return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
ANSCustomWD::~ANSCustomWD()
|
||||||
|
{
|
||||||
|
Destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<CustomObject> ANSCustomWD::RunInference(const cv::Mat& input, const std::string& camera_id) {
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(_mutex);
|
||||||
|
|
||||||
|
// Early validation
|
||||||
|
if (input.empty() || input.cols < 10 || input.rows < 10) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_detector) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
#ifdef FNS_DEBUG
|
||||||
|
cv::Mat draw = input.clone();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
std::vector<ANSCENTER::Object> output;
|
||||||
|
|
||||||
|
// A. Check if detected area is retained and valid
|
||||||
|
if (_detectedArea.width > 50 && _detectedArea.height > 50) {
|
||||||
|
output = ProcessExistingDetectedArea(input, camera_id
|
||||||
|
#ifdef FNS_DEBUG
|
||||||
|
, draw
|
||||||
|
#endif
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// B. Find new detected area
|
||||||
|
ProcessNewDetectedArea(input, camera_id, output
|
||||||
|
#ifdef FNS_DEBUG
|
||||||
|
, draw
|
||||||
|
#endif
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef FNS_DEBUG
|
||||||
|
cv::imshow("Combined Detected Areas", draw);
|
||||||
|
cv::waitKey(1);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Convert to CustomObjects
|
||||||
|
std::vector<CustomObject> results;
|
||||||
|
if (!output.empty()) {
|
||||||
|
results.reserve(output.size());
|
||||||
|
const float scoreThreshold = _detectionScoreThreshold;
|
||||||
|
|
||||||
|
for (const auto& obj : output) {
|
||||||
|
if (obj.confidence >= scoreThreshold) {
|
||||||
|
CustomObject customObj;
|
||||||
|
customObj.box = obj.box;
|
||||||
|
customObj.classId = obj.classId;
|
||||||
|
customObj.confidence = obj.confidence;
|
||||||
|
customObj.cameraId = obj.cameraId;
|
||||||
|
customObj.className = obj.className;
|
||||||
|
customObj.extraInfo = "Detection Score Threshold:" + std::to_string(scoreThreshold);
|
||||||
|
results.push_back(std::move(customObj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (results.empty()) {
|
||||||
|
UpdateNoDetectionCondition();
|
||||||
|
}
|
||||||
|
|
||||||
|
return results;
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (const std::exception& e) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<ANSCENTER::Object> ANSCustomWD::RunFilterGetPersons(const cv::Mat& frame) {
|
||||||
|
std::vector<ANSCENTER::Object> persons;
|
||||||
|
if (!_filter) return persons;
|
||||||
|
|
||||||
|
std::vector<ANSCENTER::Object> filteredObjects;
|
||||||
|
_filter->RunInference(frame, "cam", filteredObjects);
|
||||||
|
|
||||||
|
for (const auto& obj : filteredObjects) {
|
||||||
|
if (obj.classId == 0) { // person
|
||||||
|
persons.push_back(obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return persons;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<ANSCENTER::Object> ANSCustomWD::ProcessExistingDetectedArea(
|
||||||
|
const cv::Mat& frame,
|
||||||
|
const std::string& camera_id
|
||||||
|
#ifdef FNS_DEBUG
|
||||||
|
, cv::Mat& draw
|
||||||
|
#endif
|
||||||
|
) {
|
||||||
|
std::vector<ANSCENTER::Object> output;
|
||||||
|
|
||||||
|
// Validate _detectedArea is within frame bounds
|
||||||
|
cv::Rect frameRect(0, 0, frame.cols, frame.rows);
|
||||||
|
_detectedArea &= frameRect;
|
||||||
|
if (_detectedArea.width <= 0 || _detectedArea.height <= 0) {
|
||||||
|
_detectedArea = cv::Rect();
|
||||||
|
UpdateNoDetectionCondition();
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef FNS_DEBUG
|
||||||
|
cv::rectangle(draw, _detectedArea, cv::Scalar(0, 0, 255), 2); // RED
|
||||||
|
#endif
|
||||||
|
|
||||||
|
cv::Mat activeROI = frame(_detectedArea);
|
||||||
|
|
||||||
|
// Run weapon detection on cropped ROI
|
||||||
|
std::vector<ANSCENTER::Object> detectedObjects;
|
||||||
|
int detectorDetectionResult = _detector->RunInference(activeROI, camera_id.c_str(), detectedObjects);
|
||||||
|
|
||||||
|
if (detectedObjects.empty()) {
|
||||||
|
UpdateNoDetectionCondition();
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Run filter once for all candidates in this frame
|
||||||
|
std::vector<ANSCENTER::Object> personDetections = RunFilterGetPersons(frame);
|
||||||
|
bool filterHadResults = !personDetections.empty() || !_filter;
|
||||||
|
|
||||||
|
const float scoreThreshold = _detectionScoreThreshold;
|
||||||
|
std::vector<ANSCENTER::Object> movementObjects;
|
||||||
|
int detectedMovementResult = _detector->DetectMovement(activeROI, camera_id.c_str(), movementObjects);
|
||||||
|
|
||||||
|
// Convert movement objects to frame coordinates
|
||||||
|
std::vector<ANSCENTER::Object> weaponRects;
|
||||||
|
weaponRects.reserve(movementObjects.size());
|
||||||
|
for (const auto& rect : movementObjects) {
|
||||||
|
ANSCENTER::Object mObj;
|
||||||
|
mObj.box = rect.box;
|
||||||
|
mObj.box.x += _detectedArea.x;
|
||||||
|
mObj.box.y += _detectedArea.y;
|
||||||
|
weaponRects.push_back(mObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef FNS_DEBUG
|
||||||
|
for (const auto& rect : weaponRects) {
|
||||||
|
cv::rectangle(draw, rect.box, cv::Scalar(0, 255, 0), 2); // GREEN
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
for (auto& detectedObj : detectedObjects) {
|
||||||
|
// Adjust to frame coordinates
|
||||||
|
detectedObj.box.x += _detectedArea.x;
|
||||||
|
detectedObj.box.y += _detectedArea.y;
|
||||||
|
detectedObj.cameraId = camera_id;
|
||||||
|
|
||||||
|
if (detectedObj.confidence <= scoreThreshold) {
|
||||||
|
UpdateNoDetectionCondition();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const float area_threshold = calculateIoU(_detectedArea, detectedObj.box);
|
||||||
|
if (area_threshold >= 0.5f) {
|
||||||
|
UpdateNoDetectionCondition();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef FNS_DEBUG
|
||||||
|
cv::rectangle(draw, detectedObj.box, cv::Scalar(0, 255, 255), 2); // Yellow
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (weaponRects.empty()) {
|
||||||
|
UpdateNoDetectionCondition();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!IsOverlapping(detectedObj, weaponRects, 0)) {
|
||||||
|
UpdateNoDetectionCondition();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Process valid detection
|
||||||
|
if (ProcessWeaponDetection(frame, detectedObj, output, personDetections, filterHadResults
|
||||||
|
#ifdef FNS_DEBUG
|
||||||
|
, draw
|
||||||
|
#endif
|
||||||
|
)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ANSCustomWD::ProcessWeaponDetection(
|
||||||
|
const cv::Mat& frame,
|
||||||
|
ANSCENTER::Object& detectedObj,
|
||||||
|
std::vector<ANSCENTER::Object>& output,
|
||||||
|
const std::vector<ANSCENTER::Object>& personDetections,
|
||||||
|
bool filterHadResults
|
||||||
|
#ifdef FNS_DEBUG
|
||||||
|
, cv::Mat& draw
|
||||||
|
#endif
|
||||||
|
) {
|
||||||
|
// Already established as real weapon after FILTERFRAMES consecutive confirmations
|
||||||
|
if (_realWeaponCheck > FILTERFRAMES) {
|
||||||
|
AddConfirmedWeaponDetection(frame, detectedObj, output);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Filter not available - confirm directly
|
||||||
|
if (!_filter) {
|
||||||
|
AddConfirmedWeaponDetection(frame, detectedObj, output);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Filter ran but detected nothing at all - treat as inconclusive
|
||||||
|
// Require more consecutive frames before confirming without person validation
|
||||||
|
if (!filterHadResults) {
|
||||||
|
_realWeaponCheck++;
|
||||||
|
if (_realWeaponCheck > FILTERFRAMES / 2) {
|
||||||
|
AddConfirmedWeaponDetection(frame, detectedObj, output);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef FNS_DEBUG
|
||||||
|
for (const auto& person : personDetections) {
|
||||||
|
cv::rectangle(draw, person.box, cv::Scalar(23, 25, 0), 2);
|
||||||
|
cv::putText(draw, "person",
|
||||||
|
cv::Point(person.box.x, person.box.y - 10),
|
||||||
|
cv::FONT_HERSHEY_SIMPLEX, 0.5, cv::Scalar(0, 255, 0), 2);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// No persons found - weapon without person context
|
||||||
|
if (personDetections.empty()) {
|
||||||
|
_realWeaponCheck = std::max(0, _realWeaponCheck - 1);
|
||||||
|
if (_realWeaponCheck <= 0) _isRealWeaponFrame = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if weapon overlaps with ANY person (use meaningful IoU threshold)
|
||||||
|
if (IsOverlapping(detectedObj, personDetections, 0.05f)) {
|
||||||
|
AddConfirmedWeaponDetection(frame, detectedObj, output);
|
||||||
|
_realWeaponCheck++;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Detection doesn't overlap with any person
|
||||||
|
_realWeaponCheck = std::max(0, _realWeaponCheck - 1);
|
||||||
|
if (_realWeaponCheck <= 0) {
|
||||||
|
_isRealWeaponFrame = false;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ANSCustomWD::AddConfirmedWeaponDetection(
|
||||||
|
const cv::Mat& frame,
|
||||||
|
ANSCENTER::Object& detectedObj,
|
||||||
|
std::vector<ANSCENTER::Object>& output)
|
||||||
|
{
|
||||||
|
output.push_back(detectedObj);
|
||||||
|
UpdateActiveROI(frame, detectedObj);
|
||||||
|
_isWeaponDetected = true;
|
||||||
|
_retainDetectedArea = 0;
|
||||||
|
_isRealWeaponFrame = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ANSCustomWD::ProcessNewDetectedArea(
|
||||||
|
const cv::Mat& frame,
|
||||||
|
const std::string& camera_id,
|
||||||
|
std::vector<ANSCENTER::Object>& output
|
||||||
|
#ifdef FNS_DEBUG
|
||||||
|
, cv::Mat& draw
|
||||||
|
#endif
|
||||||
|
) {
|
||||||
|
// Decay _realWeaponCheck gradually instead of hard reset
|
||||||
|
_isRealWeaponFrame = false;
|
||||||
|
_realWeaponCheck = std::max(0, _realWeaponCheck - 1);
|
||||||
|
|
||||||
|
// Divide image and get priority region
|
||||||
|
std::vector<ImageSection> sections = divideImage(frame);
|
||||||
|
const int lowestPriority = getLowestPriorityRegion();
|
||||||
|
|
||||||
|
if (_currentPriority > lowestPriority || _currentPriority == 0) {
|
||||||
|
_currentPriority = getHighestPriorityRegion();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
_currentPriority++;
|
||||||
|
}
|
||||||
|
|
||||||
|
_detectedArea = getRegionByPriority(_currentPriority);
|
||||||
|
|
||||||
|
#ifdef FNS_DEBUG
|
||||||
|
cv::rectangle(draw, _detectedArea, cv::Scalar(0, 0, 255), 4); // RED
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Validate _detectedArea is within frame bounds
|
||||||
|
cv::Rect frameRect(0, 0, frame.cols, frame.rows);
|
||||||
|
_detectedArea &= frameRect;
|
||||||
|
|
||||||
|
if (_detectedArea.width <= 50 || _detectedArea.height <= 50) {
|
||||||
|
_detectedArea = cv::Rect();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
cv::Mat detectedROI = frame(_detectedArea);
|
||||||
|
std::vector<ANSCENTER::Object> detectedObjects;
|
||||||
|
int detectorResult = _detector->RunInference(detectedROI, camera_id.c_str(), detectedObjects);
|
||||||
|
|
||||||
|
if (detectedObjects.empty()) {
|
||||||
|
_detectedArea = cv::Rect();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Use configurable threshold instead of hardcoded 0.35
|
||||||
|
const float scanThreshold = std::min(_detectionScoreThreshold, 0.35f);
|
||||||
|
ANSCENTER::Object* bestDetection = nullptr;
|
||||||
|
float maxScore = 0.0f;
|
||||||
|
|
||||||
|
for (auto& detectedObj : detectedObjects) {
|
||||||
|
detectedObj.box.x += _detectedArea.x;
|
||||||
|
detectedObj.box.y += _detectedArea.y;
|
||||||
|
detectedObj.cameraId = camera_id;
|
||||||
|
|
||||||
|
if (detectedObj.confidence <= scanThreshold) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (detectedObj.confidence > maxScore) {
|
||||||
|
maxScore = detectedObj.confidence;
|
||||||
|
bestDetection = &detectedObj;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!bestDetection) {
|
||||||
|
_detectedArea = cv::Rect();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set up tracking area around the best detection
|
||||||
|
UpdateDetectedAreaFromObject(frame, *bestDetection);
|
||||||
|
_isWeaponDetected = true;
|
||||||
|
_retainDetectedArea = 0;
|
||||||
|
|
||||||
|
// Validate in the same frame — run filter to check for person overlap
|
||||||
|
std::vector<ANSCENTER::Object> personDetections = RunFilterGetPersons(frame);
|
||||||
|
bool filterHadResults = !personDetections.empty() || !_filter;
|
||||||
|
|
||||||
|
ProcessWeaponDetection(frame, *bestDetection, output, personDetections, filterHadResults
|
||||||
|
#ifdef FNS_DEBUG
|
||||||
|
, draw
|
||||||
|
#endif
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ANSCustomWD::UpdateDetectedAreaFromObject(const cv::Mat& frame, const ANSCENTER::Object& detectedObj) {
|
||||||
|
const int imageSize = std::max(frame.cols, frame.rows);
|
||||||
|
int cropSize;
|
||||||
|
|
||||||
|
if (imageSize > 1920) cropSize = 640;
|
||||||
|
else if (imageSize > 1280) cropSize = 480;
|
||||||
|
else if (imageSize > 640) cropSize = 320;
|
||||||
|
else cropSize = 224;
|
||||||
|
|
||||||
|
// Cap cropSize to frame dimensions to avoid negative clamp range (UB)
|
||||||
|
cropSize = std::min(cropSize, std::min(frame.cols, frame.rows));
|
||||||
|
if (cropSize <= 0) {
|
||||||
|
_detectedArea = cv::Rect();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const int xc = detectedObj.box.x + detectedObj.box.width / 2;
|
||||||
|
const int yc = detectedObj.box.y + detectedObj.box.height / 2;
|
||||||
|
|
||||||
|
int x1_new = std::clamp(xc - cropSize / 2, 0, frame.cols - cropSize);
|
||||||
|
int y1_new = std::clamp(yc - cropSize / 2, 0, frame.rows - cropSize);
|
||||||
|
|
||||||
|
_detectedArea.x = x1_new;
|
||||||
|
_detectedArea.y = y1_new;
|
||||||
|
_detectedArea.width = std::min(cropSize, frame.cols - _detectedArea.x);
|
||||||
|
_detectedArea.height = std::min(cropSize, frame.rows - _detectedArea.y);
|
||||||
|
}
|
||||||
|
// Functions for screen size division
|
||||||
|
double ANSCustomWD::calculateDistanceToCenter(const cv::Point& center, const cv::Rect& rect) {
|
||||||
|
cv::Point rectCenter(rect.x + rect.width / 2, rect.y + rect.height / 2);
|
||||||
|
return std::sqrt(std::pow(rectCenter.x - center.x, 2) + std::pow(rectCenter.y - center.y, 2));
|
||||||
|
}
|
||||||
|
std::vector<ANSCustomWD::ImageSection> ANSCustomWD::divideImage(const cv::Mat& image) {
|
||||||
|
if (image.empty()) {
|
||||||
|
std::cerr << "Error: Empty image!" << std::endl;
|
||||||
|
return cachedSections;
|
||||||
|
}
|
||||||
|
cv::Size currentSize(image.cols, image.rows);
|
||||||
|
|
||||||
|
// Check if the image size has changed
|
||||||
|
if (currentSize == previousImageSize) {
|
||||||
|
return cachedSections; // Return cached sections if size is the same
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update previous size
|
||||||
|
previousImageSize = currentSize;
|
||||||
|
cachedSections.clear();
|
||||||
|
|
||||||
|
int width = image.cols;
|
||||||
|
int height = image.rows;
|
||||||
|
int maxDimension = std::max(width, height);
|
||||||
|
int numSections = 10;// std::max(1, numSections); // Ensure at least 1 section
|
||||||
|
if (maxDimension <= 2560)numSections = 8;
|
||||||
|
if (maxDimension <= 1280)numSections = 6;
|
||||||
|
if (maxDimension <= 960)numSections = 4;
|
||||||
|
if (maxDimension <= 640)numSections = 2;
|
||||||
|
if (maxDimension <= 320)numSections = 1;
|
||||||
|
|
||||||
|
int gridRows = std::sqrt(numSections);
|
||||||
|
int gridCols = (numSections + gridRows - 1) / gridRows; // Ensure all sections are covered
|
||||||
|
|
||||||
|
int sectionWidth = width / gridCols;
|
||||||
|
int sectionHeight = height / gridRows;
|
||||||
|
|
||||||
|
cv::Point imageCenter(width / 2, height / 2);
|
||||||
|
std::vector<std::pair<double, ImageSection>> distancePriorityList;
|
||||||
|
|
||||||
|
// Create sections and store their distance from the center
|
||||||
|
for (int r = 0; r < gridRows; ++r) {
|
||||||
|
for (int c = 0; c < gridCols; ++c) {
|
||||||
|
int x = c * sectionWidth;
|
||||||
|
int y = r * sectionHeight;
|
||||||
|
int w = (c == gridCols - 1) ? width - x : sectionWidth;
|
||||||
|
int h = (r == gridRows - 1) ? height - y : sectionHeight;
|
||||||
|
|
||||||
|
ImageSection section(cv::Rect(x, y, w, h));
|
||||||
|
double distance = calculateDistanceToCenter(imageCenter, section.region);
|
||||||
|
distancePriorityList.emplace_back(distance, section);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sort sections based on distance from center, then top-to-bottom, then left-to-right
|
||||||
|
std::sort(distancePriorityList.begin(), distancePriorityList.end(),
|
||||||
|
[](const std::pair<double, ImageSection>& a, const std::pair<double, ImageSection>& b) {
|
||||||
|
if (std::abs(a.first - b.first) > 1e-5) {
|
||||||
|
return a.first < b.first; // Sort by closest distance to center
|
||||||
|
}
|
||||||
|
// If distance is the same, prioritize top to bottom, then left to right
|
||||||
|
return a.second.region.y == b.second.region.y
|
||||||
|
? a.second.region.x < b.second.region.x
|
||||||
|
: a.second.region.y < b.second.region.y;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Assign priority
|
||||||
|
int priority = 1;
|
||||||
|
for (auto& entry : distancePriorityList) {
|
||||||
|
entry.second.priority = priority++;
|
||||||
|
cachedSections.push_back(entry.second);
|
||||||
|
}
|
||||||
|
|
||||||
|
return cachedSections;
|
||||||
|
}
|
||||||
|
int ANSCustomWD::getHighestPriorityRegion() {
|
||||||
|
if (!cachedSections.empty()) {
|
||||||
|
return cachedSections.front().priority; // First element has the highest priority
|
||||||
|
}
|
||||||
|
return 0; // Return empty rect if no sections exist
|
||||||
|
}
|
||||||
|
int ANSCustomWD::getLowestPriorityRegion() {
|
||||||
|
if (!cachedSections.empty()) {
|
||||||
|
return cachedSections.back().priority; // Last element has the lowest priority
|
||||||
|
}
|
||||||
|
return 0; // Return empty rect if no sections exist
|
||||||
|
}
|
||||||
|
cv::Rect ANSCustomWD::getRegionByPriority(int priority) {
|
||||||
|
for (const auto& section : cachedSections) {
|
||||||
|
if (section.priority == priority) {
|
||||||
|
return section.region;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return cv::Rect(); // Return empty rect if priority not found
|
||||||
|
}
|
||||||
|
void ANSCustomWD::UpdateNoDetectionCondition() {
|
||||||
|
_isRealWeaponFrame = false;
|
||||||
|
_realWeaponCheck = 0;
|
||||||
|
if (_isWeaponDetected) {
|
||||||
|
_retainDetectedArea++;
|
||||||
|
if (_retainDetectedArea >= RETAINFRAMES) {// Reset detected area after 80 frames
|
||||||
|
_detectedArea.width = 0;
|
||||||
|
_detectedArea.height = 0;
|
||||||
|
_retainDetectedArea = 0;
|
||||||
|
_isWeaponDetected = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
_detectedArea.width = 0;
|
||||||
|
_detectedArea.height = 0;
|
||||||
|
_retainDetectedArea = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
float ANSCustomWD::calculateIoU(const cv::Rect& box1, const cv::Rect& box2) {
|
||||||
|
int x1 = std::max(box1.x, box2.x);
|
||||||
|
int y1 = std::max(box1.y, box2.y);
|
||||||
|
int x2 = std::min(box1.x + box1.width, box2.x + box2.width);
|
||||||
|
int y2 = std::min(box1.y + box1.height, box2.y + box2.height);
|
||||||
|
|
||||||
|
int intersectionArea = std::max(0, x2 - x1) * std::max(0, y2 - y1);
|
||||||
|
int box1Area = box1.width * box1.height;
|
||||||
|
int box2Area = box2.width * box2.height;
|
||||||
|
int unionArea = box1Area + box2Area - intersectionArea;
|
||||||
|
if (unionArea <= 0) return 0.0f;
|
||||||
|
|
||||||
|
return static_cast<float>(intersectionArea) / unionArea;
|
||||||
|
}
|
||||||
|
bool ANSCustomWD::IsOverlapping(const ANSCENTER::Object& obj, const std::vector<ANSCENTER::Object>& objectList, float iouThreshold)
|
||||||
|
{
|
||||||
|
for (const auto& otherObj : objectList)
|
||||||
|
{
|
||||||
|
float iou = calculateIoU(obj.box, otherObj.box);
|
||||||
|
//std::cout << "IoU: " << iou << std::endl;
|
||||||
|
if (iou > iouThreshold)
|
||||||
|
{
|
||||||
|
return true; // Overlapping found
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false; // No overlapping object found
|
||||||
|
}
|
||||||
|
|
||||||
|
void ANSCustomWD::UpdateActiveROI(const cv::Mat& frame, ANSCENTER::Object detectedObj) {
|
||||||
|
int cropSize = 640;
|
||||||
|
int imagegSize = std::max(frame.cols, frame.rows);
|
||||||
|
if (imagegSize > 1920) cropSize = 640;
|
||||||
|
else if (imagegSize > 1280) cropSize = 480;
|
||||||
|
else if (imagegSize > 640) cropSize = 320;
|
||||||
|
else cropSize = 224;
|
||||||
|
|
||||||
|
// Cap cropSize to frame dimensions to avoid negative coordinates
|
||||||
|
cropSize = std::min(cropSize, std::min(frame.cols, frame.rows));
|
||||||
|
if (cropSize <= 0) {
|
||||||
|
_detectedArea = cv::Rect();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int xc = detectedObj.box.x + detectedObj.box.width / 2;
|
||||||
|
int yc = detectedObj.box.y + detectedObj.box.height / 2;
|
||||||
|
int x1_new = std::clamp(xc - cropSize / 2, 0, frame.cols - cropSize);
|
||||||
|
int y1_new = std::clamp(yc - cropSize / 2, 0, frame.rows - cropSize);
|
||||||
|
_detectedArea.x = x1_new;
|
||||||
|
_detectedArea.y = y1_new;
|
||||||
|
_detectedArea.width = std::min(cropSize, frame.cols - _detectedArea.x);
|
||||||
|
_detectedArea.height = std::min(cropSize, frame.rows - _detectedArea.y);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ANSCustomWD::ConfigureParameters(CustomParams& param)
|
||||||
|
{
|
||||||
|
std::lock_guard<std::recursive_mutex> lock(_mutex);
|
||||||
|
try {
|
||||||
|
// Clear current parameters
|
||||||
|
param.ROI_Config.clear();
|
||||||
|
param.ROI_Options.clear();
|
||||||
|
param.Parameters.clear();
|
||||||
|
param.ROI_Values.clear();
|
||||||
|
|
||||||
|
//// Fill ROI_Config
|
||||||
|
//if (this->_params.ROI_Config.empty()) {
|
||||||
|
// // Traffic Light ROIs
|
||||||
|
// param.ROI_Config.push_back({ true, false, false, 0, 10, "TrafficLight_One", "All Corners" });
|
||||||
|
// param.ROI_Config.push_back({ true, false, false, 0, 10, "TrafficLight_Two", "All Corners" });
|
||||||
|
// param.ROI_Config.push_back({ true, false, false, 0, 10, "TrafficLight_Three", "All Corners" });
|
||||||
|
|
||||||
|
// // Vehicle Detector Zones
|
||||||
|
// param.ROI_Config.push_back({ true, true, false, 0, 10, "CarZone_One", "All Corners" });
|
||||||
|
// param.ROI_Config.push_back({ true, true, false, 0, 10, "CarZone_Two", "All Corners" });
|
||||||
|
// param.ROI_Config.push_back({ true, true, false, 0, 10, "CarZone_Three", "All Corners" });
|
||||||
|
|
||||||
|
// // Cross Line ROIs
|
||||||
|
// param.ROI_Config.push_back({ false, false, true, 0, 10, "CrossLine_One", "All Corners" });
|
||||||
|
// param.ROI_Config.push_back({ false, false, true, 0, 10, "CrossLine_Two", "All Corners" });
|
||||||
|
// param.ROI_Config.push_back({ false, false, true, 0, 10, "CrossLine_Three", "All Corners" });
|
||||||
|
//}
|
||||||
|
//else {
|
||||||
|
// // Reuse existing ROI_Config
|
||||||
|
// param.ROI_Config = this->_params.ROI_Config;
|
||||||
|
//}
|
||||||
|
|
||||||
|
//// Safely reuse ROI_Values only if valid
|
||||||
|
//size_t suspiciousCap = this->_params.ROI_Values.capacity();
|
||||||
|
//if (!this->_params.ROI_Values.empty() && suspiciousCap < 10000) {
|
||||||
|
// for (const auto& roi : this->_params.ROI_Values) {
|
||||||
|
// CustomROIValue roiValue;
|
||||||
|
// roiValue.Name = roi.Name;
|
||||||
|
// roiValue.ROIPoints = roi.ROIPoints;
|
||||||
|
// roiValue.ROIMatch = roi.ROIMatch;
|
||||||
|
// roiValue.Option = roi.Option;
|
||||||
|
// roiValue.OriginalImageSize = roi.OriginalImageSize;
|
||||||
|
// param.ROI_Values.push_back(roiValue);
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
//else {
|
||||||
|
// // Use default harcoded values
|
||||||
|
// param.ROI_Values = {
|
||||||
|
// // TrafficLight
|
||||||
|
// {"Centre Point", {{700, 100}, {950, 100}, {950, 200}, {700, 200}}, "Left side", "TrafficLight_One_1", 1920},
|
||||||
|
// {"Centre Point", {{1000, 100}, {2000, 100}, {2000, 200}, {1000, 200}}, "Left side", "TrafficLight_Two_1", 1920},
|
||||||
|
// {"Centre Point", {{2100, 100}, {2200, 100}, {2200, 200}, {2100, 200}}, "Left side", "TrafficLight_Three_1", 1920},
|
||||||
|
// // VehicleDetector
|
||||||
|
// {"Centre Point", {{700, 650}, {950, 650}, {950, 700}, {600, 700}}, "Inside ROI", "CarZone_One_1", 1920},
|
||||||
|
// {"Centre Point", {{950, 650}, {1900, 650}, {1900, 770}, {950, 700}}, "Inside ROI", "CarZone_Two_1", 1920},
|
||||||
|
// {"Centre Point", {{1900, 650}, {2150, 650}, {2150, 770}, {1900, 770}}, "Inside ROI", "CarZone_Three_1", 1920},
|
||||||
|
// // CrossLine
|
||||||
|
// {"Centre Point", {{600, 670}, {2150, 750}}, "Above", "CrossLine_One_1", 1920},
|
||||||
|
// {"Centre Point", {{600, 670}, {2150, 750}}, "Left side", "CrossLine_Two_1", 1920},
|
||||||
|
// {"Centre Point", {{600, 670}, {2150, 750}}, "Left side", "CrossLine_Three_1", 1920}
|
||||||
|
// };
|
||||||
|
//}
|
||||||
|
|
||||||
|
//// Add ALPR parameter if ALPR is available
|
||||||
|
//if (_ALPRVisible) {
|
||||||
|
// CustomParameter stALPRParam;
|
||||||
|
// stALPRParam.Name = "ALPR";
|
||||||
|
// stALPRParam.DataType = "Boolean";
|
||||||
|
// stALPRParam.NoOfDecimals = 0;
|
||||||
|
// stALPRParam.MaxValue = 0;
|
||||||
|
// stALPRParam.MinValue = 0;
|
||||||
|
// stALPRParam.StartValue = "false";
|
||||||
|
// stALPRParam.ListItems.clear();
|
||||||
|
// stALPRParam.DefaultValue = "false";
|
||||||
|
// stALPRParam.Value = _useALPR ? "true" : "false";
|
||||||
|
// param.Parameters.push_back(stALPRParam);
|
||||||
|
//}
|
||||||
|
|
||||||
|
//// Add Display TL parameter
|
||||||
|
//CustomParameter stTLParam;
|
||||||
|
//stTLParam.Name = "Show Traffic Light";
|
||||||
|
//stTLParam.DataType = "Boolean";
|
||||||
|
//stTLParam.NoOfDecimals = 0;
|
||||||
|
//stTLParam.MaxValue = 0;
|
||||||
|
//stTLParam.MinValue = 0;
|
||||||
|
//stTLParam.StartValue = "false";
|
||||||
|
//stTLParam.ListItems.clear();
|
||||||
|
//stTLParam.DefaultValue = "false";
|
||||||
|
//stTLParam.Value = _displayTL ? "true" : "false";
|
||||||
|
//param.Parameters.push_back(stTLParam);
|
||||||
|
|
||||||
|
////Add Traffic Light AI parameter
|
||||||
|
//CustomParameter stTrafficLightAI;
|
||||||
|
//stTrafficLightAI.Name = "TrafficLightAI";
|
||||||
|
//stTrafficLightAI.DataType = "Boolean";
|
||||||
|
//stTrafficLightAI.NoOfDecimals = 0;
|
||||||
|
//stTrafficLightAI.MaxValue = 0;
|
||||||
|
//stTrafficLightAI.MinValue = 0;
|
||||||
|
//stTrafficLightAI.StartValue = "false";
|
||||||
|
//stTrafficLightAI.ListItems.clear();
|
||||||
|
//stTrafficLightAI.DefaultValue = "false";
|
||||||
|
//stTrafficLightAI.Value = m_bTrafficLightAI ? "true" : "false";
|
||||||
|
//param.Parameters.push_back(stTrafficLightAI);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (const std::exception& e) {
|
||||||
|
std::cerr << "Error in ConfigureParamaters: " << e.what() << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
catch (...) {
|
||||||
|
std::cerr << "Unknown error in ConfigureParamaters." << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
91
ANSCustomWeaponDetection/ANSCustomCodeWeaponDetection.h
Normal file
91
ANSCustomWeaponDetection/ANSCustomCodeWeaponDetection.h
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
#include "ANSLIB.h"
|
||||||
|
#define RETAINFRAMES 80
|
||||||
|
#define FILTERFRAMES 10
|
||||||
|
|
||||||
|
class CUSTOM_API ANSCustomWD : public IANSCustomClass
|
||||||
|
{
|
||||||
|
struct ImageSection {
|
||||||
|
cv::Rect region;
|
||||||
|
int priority;
|
||||||
|
ImageSection(const cv::Rect& r) : region(r), priority(0) {}
|
||||||
|
};
|
||||||
|
private:
|
||||||
|
using ANSLIBPtr = std::unique_ptr<ANSCENTER::ANSLIB, decltype(&ANSCENTER::ANSLIB::Destroy)>;
|
||||||
|
ANSLIBPtr _detector{ nullptr, &ANSCENTER::ANSLIB::Destroy };
|
||||||
|
ANSLIBPtr _filter{ nullptr, &ANSCENTER::ANSLIB::Destroy };
|
||||||
|
int engineType;
|
||||||
|
std::string _detectorModelName;
|
||||||
|
std::string _detectorClassName;
|
||||||
|
int _detectorModelType; // Assuming 4 represents TensorRT YoloV11
|
||||||
|
int _detectorDetectionType; // Assuming 1 represents object detection
|
||||||
|
|
||||||
|
std::string _filterModelName;
|
||||||
|
std::string _filterClassName;
|
||||||
|
std::string _filterLabelMap;
|
||||||
|
|
||||||
|
int _filterModelType; // Assuming 1 represents OpenVINO YoloV12
|
||||||
|
int _filterDetectionType; // Assuming 1 represents object detection
|
||||||
|
|
||||||
|
std::recursive_mutex _mutex;
|
||||||
|
cv::Rect _detectedArea;// Area where weapon is detected
|
||||||
|
int _retainDetectedArea{ 0 };
|
||||||
|
bool _isWeaponDetected{ false };
|
||||||
|
float _detectionScoreThreshold{ 0.5 };
|
||||||
|
cv::Size previousImageSize = cv::Size(0, 0);
|
||||||
|
std::vector<ImageSection> cachedSections;
|
||||||
|
int _currentPriority{ 0 }; // None
|
||||||
|
int _realWeaponCheck{ 0 };
|
||||||
|
bool _isRealWeaponFrame{ false };
|
||||||
|
void UpdateNoDetectionCondition();
|
||||||
|
std::vector<ANSCENTER::Object> RunFilterGetPersons(const cv::Mat& frame);
|
||||||
|
// Function to seperate screen size
|
||||||
|
double calculateDistanceToCenter(const cv::Point& center, const cv::Rect& rect);
|
||||||
|
std::vector<ImageSection> divideImage(const cv::Mat& image);
|
||||||
|
int getHighestPriorityRegion();
|
||||||
|
int getLowestPriorityRegion();
|
||||||
|
cv::Rect getRegionByPriority(int priority);
|
||||||
|
|
||||||
|
// Utilities
|
||||||
|
float calculateIoU(const cv::Rect& box1, const cv::Rect& box2);
|
||||||
|
bool IsOverlapping(const ANSCENTER::Object& obj, const std::vector<ANSCENTER::Object>& objectList, float iouThreshold);
|
||||||
|
void UpdateActiveROI(const cv::Mat& frame, ANSCENTER::Object detectedObj);
|
||||||
|
std::vector<ANSCENTER::Object> ProcessExistingDetectedArea(
|
||||||
|
const cv::Mat& frame, const std::string& camera_id
|
||||||
|
#ifdef FNS_DEBUG
|
||||||
|
, cv::Mat& draw
|
||||||
|
#endif
|
||||||
|
);
|
||||||
|
bool ProcessWeaponDetection(
|
||||||
|
const cv::Mat& frame,
|
||||||
|
ANSCENTER::Object& detectedObj,
|
||||||
|
std::vector<ANSCENTER::Object>& output,
|
||||||
|
const std::vector<ANSCENTER::Object>& personDetections,
|
||||||
|
bool filterHadResults
|
||||||
|
#ifdef FNS_DEBUG
|
||||||
|
, cv::Mat& draw
|
||||||
|
#endif
|
||||||
|
);
|
||||||
|
void AddConfirmedWeaponDetection(
|
||||||
|
const cv::Mat& frame,
|
||||||
|
ANSCENTER::Object& detectedObj,
|
||||||
|
std::vector<ANSCENTER::Object>& output);
|
||||||
|
|
||||||
|
void ProcessNewDetectedArea(
|
||||||
|
const cv::Mat& frame,
|
||||||
|
const std::string& camera_id,
|
||||||
|
std::vector<ANSCENTER::Object>& output
|
||||||
|
#ifdef FNS_DEBUG
|
||||||
|
, cv::Mat& draw
|
||||||
|
#endif
|
||||||
|
);
|
||||||
|
void UpdateDetectedAreaFromObject(const cv::Mat& frame, const ANSCENTER::Object& detectedObj);
|
||||||
|
public:
|
||||||
|
bool Initialize(const std::string& modelDiretory,float detectionScoreThreshold, std::string& labelMap)override;
|
||||||
|
bool OptimizeModel(bool fp16)override;
|
||||||
|
std::vector<CustomObject> RunInference(const cv::Mat& input)override;
|
||||||
|
std::vector<CustomObject> RunInference(const cv::Mat& input, const std::string& camera_id)override;
|
||||||
|
bool Destroy()override;
|
||||||
|
virtual bool ConfigureParameters(CustomParams& param) override;
|
||||||
|
ANSCustomWD();
|
||||||
|
~ANSCustomWD();
|
||||||
|
};
|
||||||
60
ANSCustomWeaponDetection/CMakeLists.txt
Normal file
60
ANSCustomWeaponDetection/CMakeLists.txt
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
project(ANSCustomWeaponDetection LANGUAGES CXX)
|
||||||
|
|
||||||
|
# ---------- sources ----------
|
||||||
|
set(SOURCES
|
||||||
|
ANSCustomCodeWeaponDetection.cpp
|
||||||
|
dllmain.cpp
|
||||||
|
pch.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
set(HEADERS
|
||||||
|
ANSCustomCodeWeaponDetection.h
|
||||||
|
framework.h
|
||||||
|
pch.h
|
||||||
|
)
|
||||||
|
|
||||||
|
# ---------- shared library (DLL) ----------
|
||||||
|
add_library(${PROJECT_NAME} SHARED ${SOURCES} ${HEADERS})
|
||||||
|
|
||||||
|
# ---------- preprocessor definitions ----------
|
||||||
|
target_compile_definitions(${PROJECT_NAME} PRIVATE
|
||||||
|
ANSCUSTOMCODE_EXPORTS
|
||||||
|
_WINDOWS
|
||||||
|
_USRDLL
|
||||||
|
WIN32_LEAN_AND_MEAN
|
||||||
|
NOMINMAX
|
||||||
|
$<$<CONFIG:Debug>:_DEBUG>
|
||||||
|
$<$<CONFIG:Release>:NDEBUG>
|
||||||
|
)
|
||||||
|
|
||||||
|
# ---------- include directories ----------
|
||||||
|
target_include_directories(${PROJECT_NAME} PRIVATE
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
C:/Projects/ANLS/ANSLIB/ANSLIB
|
||||||
|
C:/ANSLibs/opencv/include
|
||||||
|
)
|
||||||
|
|
||||||
|
# ---------- library directories & linking ----------
|
||||||
|
target_link_directories(${PROJECT_NAME} PRIVATE
|
||||||
|
C:/ProgramData/ANSCENTER/Shared
|
||||||
|
C:/ANSLibs/opencv/x64/vc17/lib
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(${PROJECT_NAME} PRIVATE
|
||||||
|
ANSLIB
|
||||||
|
opencv_world4130
|
||||||
|
)
|
||||||
|
|
||||||
|
# ---------- compiler options (MSVC) ----------
|
||||||
|
if(MSVC)
|
||||||
|
target_compile_options(${PROJECT_NAME} PRIVATE
|
||||||
|
/W3 # Warning level 3
|
||||||
|
/sdl # SDL checks
|
||||||
|
/permissive- # Conformance mode
|
||||||
|
$<$<CONFIG:Release>:/O2 /Oi /GL> # Optimize + intrinsics + whole-program opt
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_options(${PROJECT_NAME} PRIVATE
|
||||||
|
$<$<CONFIG:Release>:/OPT:REF /OPT:ICF /LTCG> # Optimize refs, COMDAT folding, link-time codegen
|
||||||
|
)
|
||||||
|
endif()
|
||||||
27
ANSCustomWeaponDetection/dllmain.cpp
Normal file
27
ANSCustomWeaponDetection/dllmain.cpp
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
#include "pch.h"
|
||||||
|
#include "ANSCustomCodeWeaponDetection.h"
|
||||||
|
|
||||||
|
|
||||||
|
BOOL APIENTRY DllMain( HMODULE hModule,
|
||||||
|
DWORD ul_reason_for_call,
|
||||||
|
LPVOID lpReserved
|
||||||
|
)
|
||||||
|
{
|
||||||
|
switch (ul_reason_for_call)
|
||||||
|
{
|
||||||
|
case DLL_PROCESS_ATTACH:
|
||||||
|
case DLL_THREAD_ATTACH:
|
||||||
|
case DLL_THREAD_DETACH:
|
||||||
|
case DLL_PROCESS_DETACH:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// expose the class to the outside world
|
||||||
|
extern "C" __declspec(dllexport) IANSCustomClass* Create() {
|
||||||
|
return new ANSCustomWD();
|
||||||
|
}
|
||||||
7
ANSCustomWeaponDetection/framework.h
Normal file
7
ANSCustomWeaponDetection/framework.h
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||||
|
#define NOMINMAX // Prevent windows.h from defining min/max macros
|
||||||
|
// which break std::min / std::max (C2589)
|
||||||
|
// Windows Header Files
|
||||||
|
#include <windows.h>
|
||||||
5
ANSCustomWeaponDetection/pch.cpp
Normal file
5
ANSCustomWeaponDetection/pch.cpp
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
// pch.cpp: source file corresponding to the pre-compiled header
|
||||||
|
|
||||||
|
#include "pch.h"
|
||||||
|
|
||||||
|
// When you are using pre-compiled headers, this source file is necessary for compilation to succeed.
|
||||||
13
ANSCustomWeaponDetection/pch.h
Normal file
13
ANSCustomWeaponDetection/pch.h
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
// pch.h: This is a precompiled header file.
|
||||||
|
// Files listed below are compiled only once, improving build performance for future builds.
|
||||||
|
// This also affects IntelliSense performance, including code completion and many code browsing features.
|
||||||
|
// However, files listed here are ALL re-compiled if any one of them is updated between builds.
|
||||||
|
// Do not add files here that you will be updating frequently as this negates the performance advantage.
|
||||||
|
|
||||||
|
#ifndef PCH_H
|
||||||
|
#define PCH_H
|
||||||
|
|
||||||
|
// add headers that you want to pre-compile here
|
||||||
|
#include "framework.h"
|
||||||
|
|
||||||
|
#endif //PCH_H
|
||||||
9
CMakeLists.txt
Normal file
9
CMakeLists.txt
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.20)
|
||||||
|
project(ANSCustomModels LANGUAGES CXX)
|
||||||
|
|
||||||
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
|
add_subdirectory(ANSCustomHelmetDetection)
|
||||||
|
add_subdirectory(ANSCustomFireNSmokeDetection)
|
||||||
|
add_subdirectory(ANSCustomWeaponDetection)
|
||||||
Reference in New Issue
Block a user