This repository was archived by the owner on Nov 13, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 37
Cluster estimation filter #253
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
bf8e3da
min_points_per_cluster
szbillyang b721e38
config
szbillyang a98cf86
Merge branch 'main' of https://github.com/UWARG/computer-vision-pytho…
szbillyang f998e6b
format
szbillyang ce18ce1
fix
szbillyang 5b25de8
format
szbillyang 4e6b104
update
szbillyang 95fe301
update
szbillyang 241adcf
'format'
szbillyang 4815613
'format'
szbillyang a1904f8
'update'
szbillyang e2a5177
debug
szbillyang 322ca44
Merge branch 'main' of https://github.com/UWARG/computer-vision-pytho…
szbillyang 848b8af
integration
szbillyang cfcab8f
format
szbillyang f9fabb6
main_edit
szbillyang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| """ | ||
| Test MAVLink integration test | ||
| Test MAVLink integration test | ||
| """ | ||
|
|
||
| import multiprocessing as mp | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,6 +16,7 @@ | |
| MAX_NUM_COMPONENTS = 10 | ||
| RNG_SEED = 0 | ||
| CENTRE_BOX_SIZE = 500 | ||
| MIN_POINTS_PER_CLUSTER = 3 | ||
|
|
||
| # Test functions use test fixture signature names and access class privates | ||
| # No enable | ||
|
|
@@ -37,6 +38,7 @@ def cluster_model() -> cluster_estimation.ClusterEstimation: # type: ignore | |
| MAX_NUM_COMPONENTS, | ||
| RNG_SEED, | ||
| test_logger, | ||
| MIN_POINTS_PER_CLUSTER, | ||
|
Member
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. Did you verify the test cases to make sure that all the clusters have at least 3 points? Can you also make a test where there is a cluster that only has like 1 point (ie make a very far outlier)
Member
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. Also, did you check the integration tests? They are under |
||
| ) | ||
| assert result | ||
| assert model is not None | ||
|
|
@@ -489,3 +491,33 @@ def test_position_regular_data( | |
| break | ||
|
|
||
| assert is_match | ||
|
|
||
|
|
||
| class TestMinimumPointsPerCluster: | ||
| """ | ||
| Tests that clusters with fewer than the minimum required points are filtered out. | ||
| """ | ||
|
|
||
| __STD_DEV_REG = 1 | ||
|
|
||
| def test_outlier_is_filtered(self, cluster_model: cluster_estimation.ClusterEstimation) -> None: | ||
| """ | ||
| Verify that a single outlier (cluster with only one point) is filtered out, | ||
| while a valid cluster with enough points is retained. | ||
| """ | ||
| # Setup | ||
| valid_detections, valid_cluster_positions = generate_cluster_data([100], self.__STD_DEV_REG) | ||
| outlier_detections = generate_points_away_from_cluster( | ||
| num_points_to_generate=1, | ||
| minimum_distance_from_cluster=20, | ||
| cluster_positions=valid_cluster_positions, | ||
| ) | ||
| generated_detections = valid_detections + outlier_detections | ||
|
|
||
| # Run | ||
| result, detections_in_world = cluster_model.run(generated_detections, False) | ||
|
|
||
| # Test | ||
| assert result | ||
| assert detections_in_world is not None | ||
| assert len(detections_in_world) == 1 | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.