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

new_event_dataframe_with_data(indices, events) fails if arguments are empty #23

Open
headdab opened this issue Nov 26, 2018 · 4 comments

Comments

@headdab
Copy link

headdab commented Nov 26, 2018

The following line:

raw_type = pd.Categorical(tevents[0], categories=['RAW', 'FP', 'MISS', 'SWITCH', 'MATCH'], ordered=False)

fails with:

IndexError: list index out of range

tevents[0] fails.

@headdab
Copy link
Author

headdab commented Nov 27, 2018

I think you can fix this as such:

   @staticmethod
   def new_event_dataframe_with_data(indices, events):
        """DOCSTRING..."""
        if len(events) == 0: return MOTAccumulator.new_event_dataframe()

        tevents = list(zip(*events))

although, I think some computations fails in this case. I got some divide by zero errors, but didn't track them `down.```

@cheind
Copy link
Owner

cheind commented Nov 28, 2018

Could you provide a minimal reproducable example, so I can have an in depth look?

@headdab
Copy link
Author

headdab commented Nov 28, 2018

The failure mode is simple to understand.

If there are no objects or predictions for a frame, which can happen, e.g., when you are processing videos, then there are no events when this function is called.

While creating an example, I found an even simpler failure mode, at the same point.

import motmetrics as mm
acc = mm.MOTAccumulator(auto_id=True)
acc.update([], [], [[],[]])
print(acc.events)

@cheind
Copy link
Owner

cheind commented Nov 29, 2018

Sorry I might have misunderstood. Are you saying it fails in adding empty frames to the accumulator, or when computing the metrics with an empty accumulator?

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

2 participants