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

Add memory-mapped support for Kinetics-skeleton data converter #516

Merged
merged 5 commits into from
Jan 29, 2025

Conversation

JVPC0D3R
Copy link
Contributor

Description

This pull request introduces an updated data converter script for Kinetics-skeleton data. By default, the script continues to use the original in-memory approach (gendata). However, users can now enable memory-mapped numpy arrays (open_memmap) by passing the --use_mmap flag. This enhancement significantly reduces peak RAM usage for large datasets by processing data in configurable chunks (--chunk_size).

Key Changes

  1. New Function: gendata_mmap

    • Uses open_memmap to write data in chunks directly to disk.
    • Lowers memory usage by avoiding loading the entire dataset into memory.
  2. Command-line Flag: --use_mmap

    • Toggles between gendata (in-memory) and gendata_mmap (memory-mapped) approaches.
  3. Chunk Size: --chunk_size

    • Configurable size of data chunks to process at a time when using open_memmap.
    • Defaults to 128.

Testing

  • Verified that both modes (--use_mmap and without) produce equivalent .npy and .pkl results.
  • Tested a training loop with the spatio_temporal_gcn_learner.py script and the ST-GCN model.

@passalis
Copy link
Collaborator

Hi, thank you for your contribution. Seems fine to me. My only concern would be if it is possible to add a short documentation on this utility (e.g., on the README.md of the corresponding tools).

@JVPC0D3R
Copy link
Contributor Author

Hi, I've already added the documentation and explained the changes 🤠

passalis
passalis previously approved these changes Jan 29, 2025
Copy link
Collaborator

@passalis passalis left a comment

Choose a reason for hiding this comment

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

Thank you.

@passalis passalis added test sources Run style checks test tools Test the toolkit methods labels Jan 29, 2025
@passalis
Copy link
Collaborator

passalis commented Jan 29, 2025

It looks like there are some test failures related to PEP8 formatting issues.

https://github.com/opendr-eu/opendr/actions/runs/13030640596/job/36348929365?pr=516

Edit: Ignore the licence failures, I am working to fix them.

@passalis passalis removed the test tools Test the toolkit methods label Jan 29, 2025
@passalis
Copy link
Collaborator

Thank you! Seems fine.

@passalis passalis merged commit 2759cee into opendr-eu:master Jan 29, 2025
12 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test sources Run style checks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants