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

Import global constants from config #222

Merged
merged 9 commits into from
May 13, 2021
Merged

Conversation

johnwlambert
Copy link
Contributor

Previously, global constants like frame rate and image dimensions were scattered across the codebase, including in data_loading/synchronization_database.py and utils/camera_stats.py. This loads them from a single config file -- increasing readability for the codebase.

img_width = RING_IMG_WIDTH
img_height = RING_IMG_HEIGHT
else:
try:
Copy link
Contributor

Choose a reason for hiding this comment

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

Do the argoverse-v1.1 calibration files have image dimensions in them?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nope, they don't

img_height = STEREO_IMG_HEIGHT
else:
try:
camera_sensor_config = getattr(ArgoverseConfig.camera_sensors, camera_name)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it might be a little bit more readable if we moved validation into ArgoverseConfig.camera_sensors and avoided repeating this try/except elsewhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

making a quick note that we discussed leaving it here, for backwards compatibility

@@ -40,8 +41,8 @@

# jigger lane pixel values by [-10,10] range
LANE_COLOR_NOISE = 20
STEREO_FPS = 5
RING_CAM_FPS = 30
STEREO_FPS = ArgoverseConfig.stereo_cam_fps
Copy link
Contributor

Choose a reason for hiding this comment

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

What did you think about typing these with typing_extensions?

Copy link
Contributor

Choose a reason for hiding this comment

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

Do you think we should brainstorm alternatives to setting global variables from configuration files? I guess this would require cleaning up other stuff files ...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure -- do you mean just

STEREO_FPS: int = ArgoverseConfig.stereo_cam_fps

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated now to use typing_extensions.Final

@johnwlambert johnwlambert merged commit dab09db into master May 13, 2021
@johnwlambert johnwlambert deleted the use-global-constants branch May 13, 2021 01:37
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.

None yet

2 participants