관리 메뉴

Wiredwisdom

DVS File Type for SNN Vision Input 본문

Spiking Neural Network/SNN Basic

DVS File Type for SNN Vision Input

Duke_Ryan 2025. 7. 4. 19:25

1. Text Format (.txt) - Multiple Events at Same Timestamp

# DVS Events - Fast moving hand gesture
# Format: timestamp x y polarity
# Multiple events can occur at exactly the same timestamp
0.001234 150 200 1
0.001234 151 200 1
0.001234 152 200 1
0.001234 149 201 0
0.001234 153 200 1
0.001234 148 201 0
0.001234 154 200 1
0.001235 155 200 1
0.001235 147 202 0
0.001235 156 200 1
0.001235 146 202 0
0.001235 157 200 1
0.001236 158 200 1
0.001236 159 200 1
0.001236 145 203 0
0.001236 160 200 1
0.001236 144 203 0
0.001236 161 200 1
0.001236 143 204 0
0.001237 162 200 1
0.001237 163 200 1
0.001237 142 204 0
0.001237 164 200 1
0.001237 141 205 0

 


# Group events by timestamp
events_by_time = {}
for line in file:
    timestamp, x, y, polarity = line.split()
    if timestamp not in events_by_time:
        events_by_time[timestamp] = []
    events_by_time[timestamp].append((x, y, polarity))

 

2. HDF5 Format (.h5) - Structured Array with Simultaneous Events

 

HDF5 = Hierarchical Data Format version 5

HDF5 Origins:

Developed by: National Center for Supercomputing Applications (NCSA)

Used by: Scientific community worldwide

Applications: Climate modeling, astronomy, genomics, physics

 

# HDF5 hierarchical structure example:
file.h5
├── /events/           # Group (like a folder)
│   ├── x             # Dataset (coordinates)
│   ├── y             # Dataset (coordinates)
│   ├── t             # Dataset (timestamps)
│   └── p             # Dataset (polarity)
├── /metadata/         # Group (like a folder)
│   ├── resolution    # Attribute
│   └── camera_info   # Attribute
└── /analysis/         # Group (like a folder)
    └── statistics    # Dataset

 

python# Python code to examine HDF5 structure
import h5py
import numpy as np

# Example HDF5 file content
f = h5py.File('fast_motion_events.h5', 'r')
events = f['events'][:]

# Data structure:
print(events.dtype)
# dtype=[('x', '<u2'), ('y', '<u2'), ('t', '<u8'), ('p', '|b1')]

# Sample data showing simultaneous events:
print(events[:24])  # First 24 events
array([
    (150, 200, 1234000, 1),    # timestamp: 1234000 microseconds
    (151, 200, 1234000, 1),    # same timestamp
    (152, 200, 1234000, 1),    # same timestamp  
    (149, 201, 1234000, 0),    # same timestamp
    (153, 200, 1234000, 1),    # same timestamp
    (148, 201, 1234000, 0),    # same timestamp
    (154, 200, 1234000, 1),    # same timestamp
    (155, 200, 1235000, 1),    # next timestamp
    (147, 202, 1235000, 0),    # same timestamp
    (156, 200, 1235000, 1),    # same timestamp
    (146, 202, 1235000, 0),    # same timestamp
    (157, 200, 1235000, 1),    # same timestamp
    (158, 200, 1236000, 1),    # next timestamp
    (159, 200, 1236000, 1),    # same timestamp
    (145, 203, 1236000, 0),    # same timestamp
    (160, 200, 1236000, 1),    # same timestamp
    (144, 203, 1236000, 0),    # same timestamp
    (161, 200, 1236000, 1),    # same timestamp
    (143, 204, 1236000, 0),    # same timestamp
    (162, 200, 1237000, 1),    # next timestamp
    (163, 200, 1237000, 1),    # same timestamp
    (142, 204, 1237000, 0),    # same timestamp
    (164, 200, 1237000, 1),    # same timestamp
    (141, 205, 1237000, 0)     # same timestamp
], dtype=[('x', '<u2'), ('y', '<u2'), ('t', '<u8'), ('p', '|b1')])

 

 


# Efficient timestamp-based filtering
import h5py
events = h5py.File('events.h5')['events']
same_time_events = events[events['t'] == 1234000]

 


3. AEDAT2 Format (.aedat) - Binary Event Stream

AEDAT = Address Event Data format (또는 Address Event Representation)

AEDAT Origins:

Developed by: Neuromorphic engineering community

Primary use: Event-based vision sensors (DVS cameras)

Applications: Robotics, neuromorphic computing, bio-inspired vision

AEDAT Development Timeline:
1990s: Address Event Representation (AER) concept
2000s: AEDAT1 - First standardized format
2010s: AEDAT2 - Improved binary format  
2020s: AEDAT4 - Modern packet-based format
# AEDAT2 Binary File Structure
# Header (116 bytes):
Magic: 0xDADA0201
Version: 2
Format: Events
Width: 640
Height: 480
Created: 2025-07-04 15:30:00

# Binary Event Data (each event = 8 bytes):
# Format: [4-byte timestamp][4-byte address]
# Address encodes: x, y, polarity

Event Data (hexadecimal representation):
00012D6A 01900C81  # t=1234000, x=150, y=200, pol=1
00012D6A 01910C81  # t=1234000, x=151, y=200, pol=1  (same timestamp)
00012D6A 01920C81  # t=1234000, x=152, y=200, pol=1  (same timestamp)
00012D6A 01950C80  # t=1234000, x=149, y=201, pol=0  (same timestamp)
00012D6A 01930C81  # t=1234000, x=153, y=200, pol=1  (same timestamp)
00012D6A 01940C80  # t=1234000, x=148, y=201, pol=0  (same timestamp)
00012D6A 01940C81  # t=1234000, x=154, y=200, pol=1  (same timestamp)
00012D6B 01950C81  # t=1235000, x=155, y=200, pol=1  (next timestamp)
00012D6B 01970CA0  # t=1235000, x=147, y=202, pol=0  (same timestamp)
00012D6B 01960C81  # t=1235000, x=156, y=200, pol=1  (same timestamp)
00012D6B 01980CA0  # t=1235000, x=146, y=202, pol=0  (same timestamp)
00012D6B 01970C81  # t=1235000, x=157, y=200, pol=1  (same timestamp)

 


# Sequential reading maintains temporal order
for event in aedat_reader:
    if event.timestamp == current_timestamp:
        simultaneous_events.append(event)

 


4. AEDAT4 Format (.aedat) - Modern Packet-Based

 

{
  "header": {
    "magic": "AEDAT4.0",
    "timestamp": "2025-07-04T15:30:00.000Z",
    "source": "v2e simulation",
    "camera": {
      "width": 640,
      "height": 480,
      "pixel_size": "18.5um"
    }
  }
}

 

Event Packets (binary compressed):

Packet 1: [Type=Events][Size=1024][Count=128]
Binary Data: 7A9C3F2E8B4D... (compressed events)

Packet 2: [Type=Events][Size=1024][Count=127] 
Binary Data: 4E2A9F8C1B7D... (compressed events)

# When decompressed, contains same event data as above formats
# but organized in time-based packets for efficient streaming

 

 

 


File Size Comparison for Same Event Data

events.txt     : 1.2 KB   (human readable)
events.h5      : 0.8 KB   (binary structured)  
events.aedat2  : 0.3 KB   (compact binary)
events.aedat4  : 0.2 KB   (compressed packets)