-
Notifications
You must be signed in to change notification settings - Fork 39
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
implemented label in cluster estimation #231
base: main
Are you sure you want to change the base?
Conversation
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.
Reviewed
@@ -51,6 +58,7 @@ class ClusterEstimation: | |||
|
|||
__filter_by_covariances() | |||
Removes any cluster with covariances much higher than the lowest covariance value. | |||
|
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.
No need for this extra line, delete it
max_label = self.__current_bucket[0][2] | ||
|
||
# itterates through all possible labels | ||
for label in reversed(range(max_label)): |
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.
I feel like it's unnecessary to loop through the whole range of possible labels, like what if the labels were 2, 16, 224562? It's going to try and loop 224562 times. Just go through the points and add to bucket_lablled until the label changes (since you sorted), and then run
|
||
# checks if cluster_by_label ran succssfully | ||
if not check: | ||
self.__logger(f"did not add objects of label={label} to total object detections") |
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.
missing .warning
# itterates through all possible labels | ||
for label in reversed(range(max_label)): | ||
|
||
# creates bucket of labels |
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.
Shouldn't this be "a bucket containing points with the same label"?
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.
Reviewed
# creates bucket of points with the same label | ||
bucket_labelled = [] | ||
while ptr < len(self.__current_bucket) and self.__current_bucket[ptr][2] == label: | ||
bucket_labelled += [self.__current_bucket[ptr]] |
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.
Just use .append()
instead of this concatenation
if len(bucket_labelled) == 0: | ||
continue | ||
|
||
check, labelled_detections_in_world = self.cluster_by_label( |
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.
use the variable name result
instead of check
, as we use that for most of the things elsewhere
return False, None | ||
|
||
# sort bucket by label in descending order | ||
self.__current_bucket = self.__sort_by_labels(self.__current_bucket) |
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.
This needs to be self.__all_points
, as current_bucket
is emptied and moved over to all_points
after decide_to_run()
.
while ptr < len(self.__current_bucket) and self.__current_bucket[ptr][2] == label: | ||
bucket_labelled += [self.__current_bucket[ptr]] |
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.
Use self.__all_points
# reference label | ||
label = self.__current_bucket[ptr][2] | ||
|
||
# creates bucket of points with the same label |
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.
Add "since bucket is sorted by label"
c43b88f
to
3134b2a
Compare
No description provided.