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

get_frame_indices issue #39

Closed
JeffreyWardman opened this issue Jun 28, 2020 · 3 comments
Closed

get_frame_indices issue #39

JeffreyWardman opened this issue Jun 28, 2020 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@JeffreyWardman
Copy link

JeffreyWardman commented Jun 28, 2020

In agent_motion_prediction.ipynb:
The below seems to only work with valuse -51 to -23348 (with indices capped at -23846)
agent_indices = eval_agent_dataset.get_frame_indices(frame_number) .

A quick inspection shows that in agent.py:

self.agents_indices has values with max:1795829, min:33543, shape:(13985,) yet agents_start_index and agents_end_index are 0 and 37 respectively (frames[frame_idx]["agent_index_interval"] = array([0, 38]))
Hence there will be no valid indices and the below will return an empty array:

    def get_frame_indices(self, frame_idx: int) -> np.ndarray:
        """
        Get indices for the given frame. Here __getitem__ iterate over valid agents indices.
        This means ``__getitem__(0)`` matches the first valid agent in the dataset.
        Args:
            frame_idx (int): index of the scene

        Returns:
            np.ndarray: indices that can be used for indexing with __getitem__
        """
        frames = self.dataset.frames
        assert frame_idx < len(frames), f"frame_idx {frame_idx} is over len {len(frames)}"

        agents_start_index = frames[frame_idx]["agent_index_interval"][0]
        agents_end_index = frames[frame_idx]["agent_index_interval"][1] - 1

        mask_valid_indices = (self.agents_indices >= agents_start_index) * (self.agents_indices <= agents_end_index)
        indices = np.nonzero(mask_valid_indices)[0]
        return indices

I'm unfamiliar with the code but the get_frame_indices in the parent class is different to that in the AgentDataset class.

@lucabergamini
Copy link
Contributor

This should be related to #38 . val_data_loader/datasets/scene_indices set to 0 means only the first scene was taken for validation.

I've started #40 that also address the visualisation issue to ensure a frame with agents is always taken. Let me know if this addresses your concerns.

@JeffreyWardman
Copy link
Author

@lucabergamini great, thanks!

@lucabergamini
Copy link
Contributor

#40 has been merged. Let me know if you still see the issue after pulling master again. I'll close for now

@lucabergamini lucabergamini added the bug Something isn't working label Jul 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants