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

Floating point events + image reconstruction additional arg #8

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

Conversation

danielgehrig18
Copy link
Contributor

  • implemented events with floating point coords
  • changed int64 to uint32
  • implemented numbering of reconstructions according to index

- implemented numbering of reconstructions according to index
Copy link
Contributor

@magehrig magehrig left a comment

Choose a reason for hiding this comment

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

I don't think that we can consider uint32 to be safe. There is no guarantee that the timestamps from a rosbag are small enough to avoid overflow.

An alternative would be to have t as uint32 and have a uint64 offset. But then we need additional code to reconstruct the true timestamp.

Have you checked the file size difference if compression is used? Does it matter a lot? If yes, we could also consider more advanced compression like zstd.

Finally, the current code will break other code which explicitly constructs Event dataclasses with timestamp dtype of int64. E.g.

np.asarray(self.t, dtype='int64'))

or
ev['t'].astype('int64'))

@@ -17,7 +17,32 @@ def __post_init__(self):
assert self.x.dtype == np.uint16
assert self.y.dtype == np.uint16
assert self.p.dtype == np.uint8
assert self.t.dtype == np.int64
assert self.t.dtype == np.uint32
Copy link
Contributor

Choose a reason for hiding this comment

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

This is dangerous since we don't check that an overflow is not happening.

Copy link
Contributor

Choose a reason for hiding this comment

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

Same for other loc that are affected by this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok I am conviced, I have changed it back to int64. The memory footprint then grows from 12MB -> 13MB, which should be fine.

@@ -38,6 +38,7 @@ def download_checkpoint(path_to_model):
parser.add_argument('--timestamps_file', '-tsf', help='Path to txt file containing image reconstruction timestamps')
parser.add_argument('--upsample_rate', '-u', type=int, default=1, help='Multiplies the number of reconstructions, which effectively lowers the time window of events for E2VID. These intermediate reconstructions will not be saved to disk.')
parser.add_argument('--verbose', '-v', action='store_true', default=False, help='Verbose output')
parser.add_argument('--index_by_order', '-i', action='store_true', default=False, help='Index reconstrutions with 0,1,2,3...')
Copy link
Contributor

Choose a reason for hiding this comment

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

default is False anyway for store_true

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed this with the latest commit

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

Successfully merging this pull request may close these issues.

2 participants