Skip to content
This repository was archived by the owner on Jan 7, 2023. It is now read-only.

Multi tracking #106

Merged
merged 29 commits into from
Nov 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
06f50a8
Fix unittest compile issue
challenzhou Oct 1, 2019
d2b927e
refractor tracking module to decoupling with ROS
challenzhou Oct 1, 2019
debb9e6
integrate with tracker_kcf which also enabled kalman filter
challenzhou Oct 2, 2019
5da819d
regression tool integration in progress, ROS2 DDS got issue on messag…
challenzhou Oct 2, 2019
50b6c1a
improve KCF for padding and scaling ratio
challenzhou Oct 3, 2019
30d51e6
KM algorithm initial version
challenzhou Oct 4, 2019
0336ebf
KM algorithm works but with pool performance
challenzhou Oct 5, 2019
61c6812
Add external KM algorithm implementation, which would be more faster
challenzhou Oct 5, 2019
a06104e
Add timestamp check for track and detect
challenzhou Oct 6, 2019
7930445
improved KCF and tracker manager
challenzhou Oct 14, 2019
fe0db1e
add debug information
challenzhou Oct 14, 2019
cf6e057
tuning params
challenzhou Oct 14, 2019
84a302f
tuning parameters for ROS2
challenzhou Oct 16, 2019
f8ac05e
add state management
challenzhou Oct 16, 2019
dc165c5
tuning state management
challenzhou Oct 16, 2019
9e7e139
reformt code for merge
challenzhou Oct 17, 2019
4860170
reformat coding style
challenzhou Oct 18, 2019
c4cab30
refine log machanism
challenzhou Oct 18, 2019
8fcedc1
hungarian algorithm take effect, need more tuning
challenzhou Oct 21, 2019
56be5ea
add more log information
challenzhou Oct 21, 2019
4bd4ede
refine coding style
challenzhou Oct 22, 2019
80bd81c
add logger class
challenzhou Oct 29, 2019
a1d2ed7
improve node pub/sub according to ROS Dashing
challenzhou Oct 31, 2019
aea0f42
improve segmenter sub/pub for latest ROS2
challenzhou Oct 31, 2019
d32d0d4
tuning coding style to pass amend lint check
challenzhou Nov 1, 2019
f67da4b
tracker finish coding style improve
challenzhou Nov 1, 2019
8e0159b
improve coding style
challenzhou Nov 4, 2019
93d0835
fix compiling issue
challenzhou Nov 4, 2019
93f3c0c
fix module load corruption issue
challenzhou Nov 4, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 87 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
Language: Cpp
# BasedOnStyle: Google
AccessModifierOffset: -1
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlinesLeft: true
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: true
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: true
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
IncludeCategories:
- Regex: '^<.*\.h>'
Priority: 1
- Regex: '^<.*'
Priority: 2
- Regex: '.*'
Priority: 3
IndentCaseLabels: true
IndentWidth: 2
IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: false
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
ReflowComments: true
SortIncludes: true
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Auto
TabWidth: 8
UseTab: Never
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ qtcreator-*
# Emacs
.#*

# Vim
*.swp

# Catkin custom files
CATKIN_IGNORE
tags
11 changes: 10 additions & 1 deletion object_analytics_node/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ find_package(PCL 1.7 REQUIRED COMPONENTS

include_directories(
include
include/object_analytics_node
include/object_analytics_node/common
${object_analytics_msgs_INCLUDE_DIRS}
${message_filters_INCLUDE_DIRS}
${pcl_conversions_INCLUDE_DIRS}
Expand Down Expand Up @@ -118,6 +120,7 @@ if(${BUILD_TRACKING})
add_executable(tracker_regression src/tracker/tracking_regression.cpp
src/dataset/tr_dataset.cpp
src/dataset/trimg_dataset.cpp
src/dataset/trimg_MTdataset.cpp
src/dataset/trvid_dataset.cpp)
ament_target_dependencies(tracker_regression
"object_analytics_msgs"
Expand All @@ -133,7 +136,12 @@ if(${BUILD_TRACKING})
add_library(tracking_component SHARED
src/tracker/tracking_node.cpp
src/tracker/tracking.cpp
src/tracker/trackerKCF.cpp
src/tracker/tracking_manager.cpp
src/filter/kalman.cpp
src/common/frame.cpp
src/common/frame_obj.cpp
src/util/logger.cpp
)
target_compile_definitions(tracking_component
PRIVATE "OBJECT_ANALYTICS_NODE_BUILDING_DLL"
Expand All @@ -159,6 +167,7 @@ add_library(segmenter_component SHARED
src/segmenter/segmenter.cpp
src/segmenter/algorithm_provider_impl.cpp
src/segmenter/organized_multi_plane_segmenter.cpp
src/util/logger.cpp
)
target_compile_definitions(segmenter_component
PRIVATE "OBJECT_ANALYTICS_NODE_BUILDING_DLL"
Expand Down Expand Up @@ -262,7 +271,7 @@ if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
ament_lint_auto_find_test_dependencies()

add_subdirectory(tests)
# add_subdirectory(tests)
endif()

install(DIRECTORY launch
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
// Copyright (c) 2018 Intel Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef OBJECT_ANALYTICS_NODE__COMMON__FRAME_HPP_
#define OBJECT_ANALYTICS_NODE__COMMON__FRAME_HPP_

#include <opencv2/opencv.hpp>

#include <atomic>
#include <chrono>
#include <condition_variable>
#include <fstream>
#include <iostream>
#include <iterator>
#include <memory>
#include <mutex>
#include <queue>
#include <random>
#include <string>
#include <thread>
#include <vector>

#include "object.hpp"
#include "utility.hpp"

class sFrame
{
public:
sFrame() {}
explicit sFrame(cv::Mat & cv_frame);
sFrame(cv::Mat & cv_frame, struct timespec st);

virtual ~sFrame() = default;

bool operator==(const sFrame & c)
{
return c.stamp.tv_sec == stamp.tv_sec && c.stamp.tv_nsec == stamp.tv_nsec;
}

bool operator!=(const sFrame & c)
{
return c.stamp.tv_sec != stamp.tv_sec || c.stamp.tv_nsec != stamp.tv_nsec;
}

/**
* @brief Generate sframe from cv::Mat
*/
virtual void genFrame(cv::Mat & cv_frame);

/**
* @brief Read time stamp for each frame
*/
struct timespec getTimeStamp();

public:
cv::Mat frame;
struct timespec stamp;
};

extern bool operator<(const struct timespec & lhs, const struct timespec & rhs);
extern bool operator==(const struct timespec & lhs, const struct timespec & rhs);

#endif // OBJECT_ANALYTICS_NODE__COMMON__FRAME_HPP_
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// Copyright (c) 2018 Intel Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef OBJECT_ANALYTICS_NODE__COMMON__FRAME_OBJ_HPP_
#define OBJECT_ANALYTICS_NODE__COMMON__FRAME_OBJ_HPP_

#include <opencv2/opencv.hpp>

#include <atomic>
#include <chrono>
#include <condition_variable>
#include <fstream>
#include <iostream>
#include <iterator>
#include <memory>
#include <mutex>
#include <queue>
#include <random>
#include <string>
#include <thread>
#include <vector>


#include "frame.hpp"
#include "utility.hpp"

class FrameObjs : public sFrame
{
public:
FrameObjs() {}

virtual ~FrameObjs() = default;

/**
* @brief Generate sframe from cv::Mat and frame index
*/
virtual void genFrame(cv::Mat & cv_frame, int idx);

/**
* @brief Add detection for the frame
*/
void AddDetection(Object & detect);

/**
* @brief Add track for the frame
*/
void AddTrack(Object & track);

public:
int frame_idx = -1;

std::vector<Object> dets;
std::vector<Object> tracks;
};

#endif // OBJECT_ANALYTICS_NODE__COMMON__FRAME_OBJ_HPP_
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// Copyright (c) 2018 Intel Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef OBJECT_ANALYTICS_NODE__COMMON__OBJECT_HPP_
#define OBJECT_ANALYTICS_NODE__COMMON__OBJECT_HPP_

#include <opencv2/opencv.hpp>

#include <atomic>
#include <chrono>
#include <condition_variable>
#include <fstream>
#include <iostream>
#include <iterator>
#include <memory>
#include <mutex>
#include <queue>
#include <random>
#include <string>
#include <thread>
#include <vector>

class Object
{
public:
Object() {}
~Object() {}

public:
int ObjectIdx_;
std::string Category_;
cv::Rect2d BoundBox_;
float Confidence_;

struct timespec Stamp_;

cv::Mat Mean_;
cv::Mat Covariance_;
};

#endif // OBJECT_ANALYTICS_NODE__COMMON__OBJECT_HPP_
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Copyright (c) 2018 Intel Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef OBJECT_ANALYTICS_NODE__COMMON__UTILITY_HPP_
#define OBJECT_ANALYTICS_NODE__COMMON__UTILITY_HPP_

#ifndef UNUSED
#define UNUSED(var) \
do { \
(void)(var); \
} while (0)
#endif

#endif // OBJECT_ANALYTICS_NODE__COMMON__UTILITY_HPP_
21 changes: 14 additions & 7 deletions object_analytics_node/include/object_analytics_node/const.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,20 @@ namespace object_analytics_node
class Const
{
public:
static const char kTopicRegisteredPC2[];/**< Topic name of splitter node's input message */
static const char kTopicPC2[]; /**< Topic name of segmenter node's input message */
static const char kTopicRgb[]; /**< Topic name of 2d detection's input message */
static const char kTopicSegmentation[]; /**< Topic name of segmenter node's output message*/
static const char kTopicDetection[]; /**< Topic name of 2d detection's output message */
static const char kTopicLocalization[]; /**< Topic name of merger node's output message */
static const char kTopicTracking[]; /**< Topic name of tracker node's output message */
static const char
kTopicRegisteredPC2[]; /**< Topic name of splitter node's input message */
static const char
kTopicPC2[]; /**< Topic name of segmenter node's input message */
static const char
kTopicRgb[]; /**< Topic name of 2d detection's input message */
static const char
kTopicSegmentation[]; /**< Topic name of segmenter node's output message*/
static const char
kTopicDetection[]; /**< Topic name of 2d detection's output message */
static const char
kTopicLocalization[]; /**< Topic name of merger node's output message */
static const char
kTopicTracking[]; /**< Topic name of tracker node's output message */
};
} // namespace object_analytics_node
#endif // OBJECT_ANALYTICS_NODE__CONST_HPP_
Loading