File size: 8,805 Bytes
1fd74c4
fb567f9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1fd74c4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
fb567f9
2ac8ce3
fb567f9
 
1fd74c4
 
 
 
 
fb567f9
1fd74c4
fb567f9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
---
license: mit
task_categories:
- image-classification
- object-detection
- visual-question-answering
- zero-shot-image-classification
language:
- en
tags:
- ego4d
- egocentric-vision
- computer-vision
- random-sampling
- video-frames
- first-person-view
- activity-recognition
size_categories:
- 10K<n<100K
pretty_name: Ego4D Random Views Dataset
dataset_info:
  features:
  - name: image
    dtype: image
  - name: frame_id
    dtype: string
  - name: video_uid
    dtype: string
  - name: video_filename
    dtype: string
  - name: video_path
    dtype: string
  - name: frame_idx
    dtype: int32
  - name: total_frames
    dtype: int32
  - name: timestamp_sec
    dtype: float32
  - name: fps
    dtype: float32
  - name: worker_id
    dtype: int32
  - name: generated_at
    dtype: string
  - name: image_width
    dtype: int32
  - name: image_height
    dtype: int32
  - name: original_shape_height
    dtype: int32
  - name: original_shape_width
    dtype: int32
  - name: original_shape_channels
    dtype: int32
  splits:
  - name: train
    num_bytes: 21000000000
    num_examples: 20000
  download_size: 21000000000
  dataset_size: 21000000000
configs:
- config_name: default
  data_files:
  - split: train
    path: data/train-*
viewer: true
---

# Ego4D Random Views Dataset

This dataset contains **20,000 random view frames** sampled from the [Ego4D dataset](https://ego4d-data.org/) using a high-performance multi-process generation system.

![Dataset Preview](https://huggingface.co/datasets/weikaih/ego4d-random-views-20k/resolve/main/preview.jpg)

## Dataset Overview

- **Total Images**: 20,000 high-quality frames
- **Image Format**: PNG (1024×1024 resolution)  
- **Source**: Ego4D v2 dataset (52,665+ video files)
- **Sampling Method**: Multi-process random sampling with maximum diversity
- **Generation Time**: 797.57 seconds (~13 minutes)
- **Generation Speed**: 25.08 frames/second
- **Success Rate**: 100.0%

## Key Features

🎬 **Maximum Diversity**: Sampled from 50,000+ different Ego4D videos  
🚀 **High Performance**: Generated using 128 parallel workers  
📊 **Complete Metadata**: Full metadata for each frame including video source, timestamp, etc.  
🎯 **High Quality**: 1024×1024 resolution PNG images  
💾 **Efficient Storage**: Stored in parquet format for fast loading  
🔍 **Rich Context**: Each frame includes video UID, timestamp, and source information

## Dataset Schema

Each sample contains:

| Field | Type | Description |
|-------|------|-------------|
| `image` | Image | The frame image (1024×1024 PNG) |
| `frame_id` | string | Unique frame identifier |
| `video_uid` | string | Original Ego4D video UID |
| `video_filename` | string | Source video filename |
| `video_path` | string | Full path to source video |
| `frame_idx` | int32 | Frame index in original video |
| `total_frames` | int32 | Total frames in source video |
| `timestamp_sec` | float32 | Timestamp in video (seconds) |
| `fps` | float32 | Video frame rate |
| `worker_id` | int32 | Generation worker ID |
| `generated_at` | string | Generation timestamp |
| `image_width` | int32 | Image width (1024) |
| `image_height` | int32 | Image height (1024) |
| `original_shape_*` | int32 | Original video frame dimensions |

## Usage

### Quick Start

```python
from datasets import load_dataset

# Load the dataset
dataset = load_dataset("weikaih/ego4d-random-views-20k")

# Get a sample
sample = dataset['train'][0]
image = sample['image']  # PIL Image
print(f"Video: {sample['video_filename']}")
print(f"Timestamp: {sample['timestamp_sec']:.2f}s")
```

### Exploring the Data

```python
import matplotlib.pyplot as plt

# Display a sample image
sample = dataset['train'][42]
plt.figure(figsize=(10, 6))

plt.subplot(1, 2, 1)
plt.imshow(sample['image'])
plt.title(f"Frame from {sample['video_uid'][:8]}...")
plt.axis('off')

plt.subplot(1, 2, 2)
plt.text(0.1, 0.8, f"Video: {sample['video_filename'][:30]}...")
plt.text(0.1, 0.7, f"Timestamp: {sample['timestamp_sec']:.2f}s")
plt.text(0.1, 0.6, f"Frame: {sample['frame_idx']}/{sample['total_frames']}")
plt.text(0.1, 0.5, f"FPS: {sample['fps']}")
plt.axis('off')
plt.show()
```

### PyTorch Integration

```python
import torch
from torch.utils.data import DataLoader
from torchvision import transforms

# Define transforms
transform = transforms.Compose([
    transforms.Resize((224, 224)),
    transforms.ToTensor(),
    transforms.Normalize(mean=[0.485, 0.456, 0.406], 
                       std=[0.229, 0.224, 0.225])
])

# Custom dataset class
class Ego4DDataset(torch.utils.data.Dataset):
    def __init__(self, hf_dataset, transform=None):
        self.dataset = hf_dataset
        self.transform = transform
    
    def __len__(self):
        return len(self.dataset)
    
    def __getitem__(self, idx):
        sample = self.dataset[idx]
        image = sample['image']
        
        if self.transform:
            image = self.transform(image)
        
        return image, sample

# Create dataset and dataloader
pytorch_dataset = Ego4DDataset(dataset['train'], transform=transform)
dataloader = DataLoader(pytorch_dataset, batch_size=32, shuffle=True)

# Training loop example
for batch_idx, (images, metadata) in enumerate(dataloader):
    # Your training code here
    print(f"Batch {batch_idx}: {images.shape}")
    if batch_idx >= 2:  # Just show first few batches
        break
```

### Data Analysis

```python
import pandas as pd
from collections import Counter

# Convert to pandas for analysis
data = []
for sample in dataset['train']:
    data.append({
        'video_uid': sample['video_uid'],
        'timestamp_sec': sample['timestamp_sec'],
        'fps': sample['fps'],
        'total_frames': sample['total_frames'],
        'worker_id': sample['worker_id']
    })

df = pd.DataFrame(data)

# Basic statistics
print(f"Unique videos: {df['video_uid'].nunique()}")
print(f"Average FPS: {df['fps'].mean():.2f}")
print(f"Timestamp range: {df['timestamp_sec'].min():.2f}s - {df['timestamp_sec'].max():.2f}s")

# Video distribution
video_counts = Counter(df['video_uid'])
print(f"Samples per video - Min: {min(video_counts.values())}, Max: {max(video_counts.values())}")
```

## Applications

This dataset is suitable for:

- **Egocentric vision research**: First-person view understanding
- **Activity recognition**: Daily activity classification
- **Object detection**: Objects in natural settings
- **Scene understanding**: Indoor/outdoor scene analysis  
- **Transfer learning**: Pre-training for egocentric tasks
- **Multi-modal learning**: Combining with video metadata
- **Temporal analysis**: Using timestamp information

## Generation Statistics

- **Target Frames**: 20,000
- **Generated Frames**: 20,000
- **Success Rate**: 100.0%
- **Generation Time**: 13.3 minutes
- **Workers Used**: 128
- **Processing Speed**: 25.08 frames/second
- **Source Videos**: 52,665+ Ego4D video files
- **Diversity**: Maximum diversity through distributed sampling

## Technical Details

### Sampling Strategy
- **Random Selection**: Both video and frame positions randomly sampled
- **Worker Distribution**: Videos distributed across 128 workers for diversity
- **Quality Control**: Automatic validation and error recovery
- **Metadata Preservation**: Complete provenance tracking

### Data Quality
- **Image Quality**: All frames validated during generation
- **Resolution**: Consistent 1024×1024 PNG format  
- **Color Space**: RGB color space
- **Compression**: PNG lossless compression
- **Metadata Completeness**: 100% metadata coverage

## Citation

If you use this dataset, please cite the original Ego4D paper:

```bibtex
@inproceedings{grauman2022ego4d,
  title={Ego4d: Around the world in 3,000 hours of egocentric video},
  author={Grauman, Kristen and Westbury, Andrew and Byrnes, Eugene and others},
  booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  pages={18211--18230},
  year={2022}
}
```

## License

This dataset follows the same license terms as the original Ego4D dataset. Please refer to the [Ego4D license](https://ego4d-data.org/pdfs/Ego4D-License.pdf) for usage terms.

## Dataset Creation

This dataset was generated using a high-performance multi-process sampling system designed for maximum diversity and efficiency. The generation process:

1. **Video Indexing**: Scanned 52,665+ Ego4D video files
2. **Distributed Sampling**: Used 128 parallel workers for maximum diversity
3. **Quality Assurance**: Validated each frame during generation
4. **Metadata Collection**: Captured complete provenance information
5. **Efficient Upload**: Used HuggingFace datasets library with parquet format

For more details on the generation process, see the [technical documentation](https://github.com/your-repo/ego4d-random-sampling).