Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dlib
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
dlib
Commits
1570899c
Commit
1570899c
authored
May 12, 2012
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improved aserts
parent
40e45d99
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
12 deletions
+39
-12
find_max_factor_graph_potts.h
dlib/graph_cuts/find_max_factor_graph_potts.h
+39
-12
No files found.
dlib/graph_cuts/find_max_factor_graph_potts.h
View file @
1570899c
...
@@ -541,25 +541,52 @@ namespace dlib
...
@@ -541,25 +541,52 @@ namespace dlib
)
)
{
{
#ifdef ENABLE_ASSERTS
#ifdef ENABLE_ASSERTS
for
(
unsigned
long
i
=
0
;
i
<
prob
.
number_of_nodes
();
++
i
)
for
(
unsigned
long
node_i
=
0
;
node_i
<
prob
.
number_of_nodes
();
++
node_
i
)
{
{
for
(
unsigned
long
jj
=
0
;
jj
<
prob
.
number_of_neighbors
(
i
);
++
jj
)
for
(
unsigned
long
jj
=
0
;
jj
<
prob
.
number_of_neighbors
(
node_
i
);
++
jj
)
{
{
unsigned
long
j
=
prob
.
get_neighbor
(
i
,
jj
);
unsigned
long
node_j
=
prob
.
get_neighbor
(
node_i
,
jj
);
DLIB_ASSERT
(
prob
.
factor_value_disagreement
(
i
,
j
)
>=
0
,
DLIB_ASSERT
(
prob
.
get_neighbor_idx
(
node_j
,
node_i
)
<
prob
.
number_of_neighbors
(
node_j
),
"
\t
void find_max_factor_graph_potts(prob)"
<<
"
\n\t
The supplied potts problem defines an invalid graph."
<<
"
\n\t
node_i: "
<<
node_i
<<
"
\n\t
node_j: "
<<
node_j
<<
"
\n\t
prob.get_neighbor_idx(node_j,node_i): "
<<
prob
.
get_neighbor_idx
(
node_j
,
node_i
)
<<
"
\n\t
prob.number_of_neighbors(node_j): "
<<
prob
.
number_of_neighbors
(
node_j
)
);
DLIB_ASSERT
(
prob
.
get_neighbor_idx
(
node_i
,
prob
.
get_neighbor
(
node_i
,
jj
))
==
jj
,
"
\t
void find_max_factor_graph_potts(prob)"
<<
"
\n\t
The get_neighbor_idx() and get_neighbor() functions must be inverses of each other."
<<
"
\n\t
node_i: "
<<
node_i
<<
"
\n\t
jj: "
<<
jj
<<
"
\n\t
prob.get_neighbor(node_i,jj): "
<<
prob
.
get_neighbor
(
node_i
,
jj
)
<<
"
\n\t
prob.get_neighbor_idx(node_i,prob.get_neighbor(node_i,jj)): "
<<
prob
.
get_neighbor_idx
(
node_i
,
node_j
)
);
DLIB_ASSERT
(
prob
.
get_neighbor
(
node_j
,
prob
.
get_neighbor_idx
(
node_j
,
node_i
))
==
node_i
,
"
\t
void find_max_factor_graph_potts(prob)"
<<
"
\n\t
The get_neighbor_idx() and get_neighbor() functions must be inverses of each other."
<<
"
\n\t
node_i: "
<<
node_i
<<
"
\n\t
node_j: "
<<
node_j
<<
"
\n\t
prob.get_neighbor_idx(node_j,node_i): "
<<
prob
.
get_neighbor_idx
(
node_j
,
node_i
)
<<
"
\n\t
prob.get_neighbor(node_j,prob.get_neighbor_idx(node_j,node_i)): "
<<
prob
.
get_neighbor
(
node_j
,
prob
.
get_neighbor_idx
(
node_j
,
node_i
))
);
DLIB_ASSERT
(
prob
.
factor_value_disagreement
(
node_i
,
node_j
)
>=
0
,
"
\t
void find_max_factor_graph_potts(prob)"
"
\t
void find_max_factor_graph_potts(prob)"
<<
"
\n\t
Invalid inputs were given to this function."
<<
"
\n\t
Invalid inputs were given to this function."
<<
"
\n\t
i: "
<<
i
<<
"
\n\t
node_i: "
<<
node_
i
<<
"
\n\t
j: "
<<
j
<<
"
\n\t
node_j: "
<<
node_
j
<<
"
\n\t
prob.factor_value_disagreement(
i,j): "
<<
prob
.
factor_value_disagreement
(
i
,
j
)
<<
"
\n\t
prob.factor_value_disagreement(
node_i,node_j): "
<<
prob
.
factor_value_disagreement
(
node_i
,
node_
j
)
);
);
DLIB_ASSERT
(
prob
.
factor_value_disagreement
(
i
,
j
)
==
prob
.
factor_value_disagreement
(
j
,
i
),
DLIB_ASSERT
(
prob
.
factor_value_disagreement
(
node_i
,
node_j
)
==
prob
.
factor_value_disagreement
(
node_j
,
node_
i
),
"
\t
void find_max_factor_graph_potts(prob)"
"
\t
void find_max_factor_graph_potts(prob)"
<<
"
\n\t
Invalid inputs were given to this function."
<<
"
\n\t
Invalid inputs were given to this function."
<<
"
\n\t
i: "
<<
i
<<
"
\n\t
node_i: "
<<
node_
i
<<
"
\n\t
j: "
<<
j
<<
"
\n\t
node_j: "
<<
node_
j
<<
"
\n\t
prob.factor_value_disagreement(
i,j): "
<<
prob
.
factor_value_disagreement
(
i
,
j
)
<<
"
\n\t
prob.factor_value_disagreement(
node_i,node_j): "
<<
prob
.
factor_value_disagreement
(
node_i
,
node_
j
)
<<
"
\n\t
prob.factor_value_disagreement(
j,i): "
<<
prob
.
factor_value_disagreement
(
j
,
i
)
<<
"
\n\t
prob.factor_value_disagreement(
node_j,node_i): "
<<
prob
.
factor_value_disagreement
(
node_j
,
node_
i
)
);
);
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment