This directory contains example scripts showing how to use GoByte's NumPy output files.
GoByte's NumPy export format provides significant advantages over CSV:
- 3-4x smaller file sizes (18 GB vs 50-70 GB for the same dataset)
- 10-20x faster loading times (2-5 seconds vs 30-60 seconds)
- Native ML/DL integration with PyTorch, TensorFlow, and JAX (zero-copy)
- Memory efficient streaming mode (~200-300 MB RAM)
- Binary format - no string conversion overhead
Recommendation: Use NumPy format for all ML/DL workflows. Reserve CSV for small samples and human inspection only.
Basic example: Load and inspect NumPy files.
python3 01_basic_loading.pyExample: Use class mapping JSON to convert integer labels to names.
python3 02_class_mapping.pyWe recommend using uv for fast and reliable package management:
# Using uvx (recommended - no installation needed)
uvx --with numpy python3 01_basic_loading.py
uvx --with numpy python3 02_class_mapping.py
# Or install NumPy locally
uv add numpyAlternatively, you can use pip if you prefer:
pip install numpy-
Streaming Mode (Recommended for large datasets - memory efficient):
./gobyte --dataset PCAP --format numpy --length 1500 --streaming --output test_classes.npy
-
Batch Mode (For single files - in-memory). Caution: This mode will load all packets into memory, which may cause OOM errors for large datasets based on --length flag.
./gobyte --input file.pcap --format numpy --length 1500 --output single.npy
Run examples using uvx (recommended):
cd example
uvx --with numpy python3 01_basic_loading.py
uvx --with numpy python3 02_class_mapping.pyOr with locally installed NumPy:
python3 01_basic_loading.py
python3 02_class_mapping.pyAfter running GoByte, you'll have:
output/test_classes_data.npy- Packet data (N × 1500 uint8)output/test_classes_labels.npy- Class labels (N × 1 uint8)output/test_classes_classes.json- Class ID to name mapping
- Format: NumPy v2.0 (binary format)
- Data Type:
uint8(0-255) - Shape: Data is (N, 1500), Labels is (N,)
- Storage: Raw binary (no string conversion)