33 if (nodes_ !=
nullptr) {
40 void Init(
int rows,
int cols) {
41 if (rows_ * cols_ != rows * cols) {
42 if (nodes_ !=
nullptr) {
45 nodes_ = algorithm::IAlloc2<Node>(rows, cols);
46 rows_ =
static_cast<int>(rows);
47 cols_ =
static_cast<int>(cols);
56 void SetData(
const float*
const* prob_map,
const float* offset_map,
57 float scale,
float objectness_threshold);
68 bool BuildNodes(
int start_row_index,
int end_row_index);
80 uint32_t center_node = 0;
88 inline uint16_t get_node_rank() {
return status & 2047; }
89 inline void set_node_rank(uint16_t node_rank) {
93 inline uint16_t get_traversed() {
94 uint16_t pattern = 14336;
95 return static_cast<uint16_t
>((status & pattern) >> 11);
97 inline void set_traversed(uint16_t traversed) {
100 status |=
static_cast<uint16_t
>((traversed & pattern) << 11);
102 inline bool is_center() {
return static_cast<bool>(status & 32768); }
103 inline void set_is_center(
bool is_center) {
110 inline bool is_object() {
return static_cast<bool>(status & 16384); }
111 inline void set_is_object(
bool is_object) {
121 void Traverse(
Node* x);
132 void DisjointSetUnion(
Node* x,
Node* y);
137 Node** nodes_ =
nullptr;
139 const float*
const* prob_map_ =
nullptr;
140 const float* offset_map_ =
nullptr;
142 float objectness_threshold_ = 0.f;
144 lib::ThreadWorker worker_;
145 bool first_process_ =
true;
148 static const size_t kDefaultReserveSize = 500;