-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(3a -> 3) Add method to match instances across views #1579
Changes from all commits
71db786
f6be8c4
c4690ec
e495241
4470c0e
d83ea64
9020afb
443d410
c3a8173
9d61980
08eb996
34a4dcd
a330c69
e78642e
712319c
ddbd19c
9454943
545dd44
3fe0246
118cf37
f7b178b
ca6319a
176efb2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -500,7 +500,6 @@ def _points_dict_to_array( | |
) | ||
try: | ||
parray[skeleton.node_to_index(node)] = point | ||
# parray[skeleton.node_to_index(node.name)] = point | ||
except: | ||
logger.debug( | ||
f"Could not set point for node {node} in {skeleton} " | ||
|
@@ -729,9 +728,31 @@ def update_points(self, points: np.ndarray, exclude_complete: bool = False): | |
for point_new, points_old, node_name in zip( | ||
points, self._points, self.skeleton.node_names | ||
): | ||
|
||
# Skip if new point is nan or old point is complete | ||
if np.isnan(point_new).any() or (exclude_complete and points_old.complete): | ||
continue | ||
points_dict[node_name] = Point(x=point_new[0], y=point_new[1]) | ||
|
||
# Grab the x, y from the new point and visible, complete from the old point | ||
x, y = point_new | ||
visible = points_old.visible | ||
complete = points_old.complete | ||
|
||
# Create a new point and add to the dict | ||
if type(self._points) == PredictedPointArray: | ||
# TODO(LM): The point score is meant to rate the confidence of the | ||
# prediction, but this method updates from triangulation. | ||
score = points_old.score | ||
point_obj = PredictedPoint( | ||
x=x, y=y, visible=visible, complete=complete, score=score | ||
) | ||
else: | ||
point_obj = Point(x=x, y=y, visible=visible, complete=complete) | ||
|
||
Comment on lines
+742
to
+751
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ensure consistent handling of point types in The method differentiates between |
||
# Update the points dict | ||
points_dict[node_name] = point_obj | ||
|
||
# Update the points | ||
if len(points_dict) > 0: | ||
Instance._points_dict_to_array(points_dict, self._points, self.skeleton) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid using a bare
except
statement.Using a bare
except
can catch unexpected exceptions and make debugging difficult. Specify the exception type or handle the generalException
and log the error for better error management.Committable suggestion