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

heatmap diffusion convolution confusion #1741

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

Conversation

pejotejo
Copy link
Contributor

Why? What?

changes heatmap decay in single cells to diffusion.

Ideas for Next Iterations (Not This PR)

decay based on viewing direction (#1676)

How to Test

Behavior Sim
or let robot play and look at heatmap

@@ -70,7 +71,7 @@ impl SearchSuggestor {
}

pub fn cycle(&mut self, mut context: CycleContext) -> Result<MainOutputs> {
self.update_heatmap(&context);
let _ = self.update_heatmap(&context);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do you choose to silently ignore the error?

@@ -107,7 +108,28 @@ impl SearchSuggestor {
}
}

self.heatmap.map *= 1.0 - context.search_suggestor_configuration.heatmap_decay_factor;
let kernel: Array2<f32> = 1.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extract kernel creation to new function

self.heatmap.map =
self.heatmap
.map
.conv(&kernel, ConvMode::Same, PaddingMode::Replicate)?;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you sure PaddingMode::Zero isn't more appropriate here?

self.heatmap
.map
.conv(&kernel, ConvMode::Same, PaddingMode::Replicate)?;
self.heatmap.map /= self.heatmap.map.sum() + f32::EPSILON;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of adding f32::EPSILON, initialize the heatmap with 1.0 / number_of_grid_cells. Then the heatmap can never sum up to 0.0

Comment on lines +117 to +125
[1.0, 1.0, 1.0],
[
1.0,
context
.search_suggestor_configuration
.heatmap_convolution_kernel_weight,
1.0
],
[1.0, 1.0, 1.0]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find it much more intuitive to have the kernel be [[a, a, a], [a, 1-a, a], [a, a, a]] with a in [0, 1]

@oleflb oleflb self-assigned this Mar 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Request for Review
Development

Successfully merging this pull request may close these issues.

2 participants