Skip to content
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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Aleksa-M
Copy link
Contributor

No description provided.

Copy link
Member

@maxlou05 maxlou05 left a 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.

Copy link
Member

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)):
Copy link
Member

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")
Copy link
Member

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
Copy link
Member

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"?

Copy link
Member

@maxlou05 maxlou05 left a 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]]
Copy link
Member

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(
Copy link
Member

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)
Copy link
Member

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().

Comment on lines 189 to 190
while ptr < len(self.__current_bucket) and self.__current_bucket[ptr][2] == label:
bucket_labelled += [self.__current_bucket[ptr]]
Copy link
Member

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
Copy link
Member

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"

@Aleksa-M Aleksa-M force-pushed the cluster-estimation-labels branch from c43b88f to 3134b2a Compare January 7, 2025 02:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants