You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Polishing H5 support and simplifying saving/checking logic (#154)
* adds h5py to install guide instructions
* adds ack for the `.h5` contribution
* simplifies and moves inspect_h5 to utils.py
* * adds make_h5_key function to generate h5 group names
* brushes up existance logic and style
* follow up
* raise if .extract is called on BaseExtractor
* adds doc for h5
* pin h5py version
* replaced the exact function with the fn from the map
* slightly improved doc
* simplified saving/checking logic into generic functions
* adds tests for h5
* moves all writes and loads to two functions
* now h5 writing is done per feature key, not all keys at once
* feature path construction now supports h5 as well as prev formats
* puts back the default output feat keys
* fixes bug for a test
# (defaults to printing; use on_extraction=save_numpy or save_h5 to save to disk)
54
+
# (defaults to printing; use on_extraction=save_numpy or save_h5 or save_pickle to save to disk)
55
55
python main.py \
56
56
feature_type=r21d \
57
57
device="cuda:0" \
@@ -94,14 +94,7 @@ Output is defined by the `on_extraction` argument; by default it prints the feat
94
94
Possible values of output are `['print', 'save_numpy', 'save_pickle', 'save_h5']`.
95
95
96
96
***`save_numpy` / `save_pickle`**: Saves the features in the `output_path` folder with the same name as the input video file but with the `.npy` or `.pkl` extension.
97
-
***`save_h5`**: Saves features into a single HDF5 file per device in the `output_path` (e.g. `video_features_cuda0.h5` or `video_features_cpu.h5`). The features are stored as datasets inside the file, using the video filename as the group key.
98
-
> **Tip for HDF5:** Since `save_h5` appends to the same file (e.g. `video_features_cuda0.h5`), we recommend using different `output_path` directories for different datasets (e.g. `./output/train` vs `./output/test`) to keep your data logically separate.
99
-
### Inspecting H5 Files
100
-
If you used `save_h5`, you can verify the contents of the generated file using the provided utility script. This will print the video names and feature shapes stored inside.
***`save_h5`**: Saves features into a single HDF5 file per device in the `output_path` (e.g. `video_features_cuda0.h5`) with video path as keys (`/`/`\\` replaced by `_`). Structure: `file.h5 / video_key (group) / feature_name (rgb, flow, fps etc)`. Use `utils.py/inspect_h5()` to explore the content.
105
98
106
99
107
100
## Used in
@@ -119,6 +112,7 @@ Please, let me know if you found this repo useful for your projects or papers.
119
112
-[@ohjho](https://github.com/ohjho): added support of 37-layer R(2+1)d favors.
120
113
-[@borijang](https://github.com/borijang): for solving bugs with file names, I3D checkpoint loading enhancement and code style improvements.
121
114
-[@bjuncek](https://github.com/bjuncek): for helping with timm models and offline discussion.
115
+
-[@VivekNarula7](https://github.com/VivekNarula7): for adding support for `.h5` output format.
0 commit comments