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

How to reuse information from the previous frame??? #40

Open
xiaowuge1201 opened this issue May 13, 2024 · 2 comments
Open

How to reuse information from the previous frame??? #40

xiaowuge1201 opened this issue May 13, 2024 · 2 comments

Comments

@xiaowuge1201
Copy link

How to solve the problem of dimensional misalignment caused by the inconsistency between the number of agents in the previous frame and the number in this frame???
How to cache the data from the previous frame???
If there is relevant code, I hope to open source the relevant code
If there is no relevant code, please provide a detailed explanation of the solution to this problem.
Thank you very much

@HUXING8
Copy link

HUXING8 commented May 13, 2024

I have the question same as yours.

@SunHaoOne
Copy link

Based on our experimental validation, we have observed some critical insights regarding the usage of caching to ensure consistent inference results:
Here's an example of how data is concatenated in the model to maintain alignment:

def forward(self, x_a_past, inputs):
    if x_a is not None:
        x_a = torch.cat([x_a, x_a_past])
    return x_a, x_a[1:]

Model Strategies:

Two model are used to handle cache.

  • Full Model: This model does not rely on caching and processes all available data.
  • Cache Model: Similar to a KVCache official implementation, this model uses cached results to optimize processing. It's particularly useful when data alignment can be guaranteed.

Strategies for Effective Caching:

  • Limiting Agent Count: By restricting the number of agents (e.g., A=8, 16), we focus on the agents that frequently interact with the subject vehicle, simplifying the caching process.
  • ID Tracking: If the same IDs are present in consecutive frames, we can align and concatenate them based on their order from the previous frame to utilize cached features effectively.
  • Handling ID Changes: In cases where new IDs appear or existing IDs disappear, the full model is deployed to accommodate the change.

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

No branches or pull requests

3 participants