tuhink's picture
Add README with dataset documentation and sample GIFs
2876545 verified
|
raw
history blame
5.07 kB
# CameraBench Binary Evaluation Dataset
A balanced VQA dataset for evaluating camera motion understanding in videos.
## πŸ“Š Dataset Statistics
- **Total Questions**: 232
- **Unique Videos**: 115
- **Unique Questions**: 15
- **Yes Answers**: 116 (50.0%)
- **No Answers**: 116 (50.0%)
- **Balance Ratio**: 1.00
- **Total Size**: 121.22 MB (0.12 GB)
- **Average Video Size**: 1.05 MB
## 🎯 Task Categories
This dataset covers various camera motion tasks including:
- **Static**: 39 questions
- **Move In**: 27 questions
- **Pan Right**: 26 questions
- **Roll Counterclockwise**: 22 questions
- **Pan Left**: 21 questions
- **Move Left**: 20 questions
- **Roll Clockwise**: 18 questions
- **Move Up**: 18 questions
- **Move Out**: 18 questions
- **Tilt Up**: 17 questions
- **Move Right**: 14 questions
- **Move Down**: 14 questions
- **Zoom In**: 14 questions
- **Tilt Down**: 13 questions
- **Zoom Out**: 12 questions
## πŸ“ Dataset Format
Each record contains:
- `video_name`: Original video filename
- `video`: Video file (MP4 format, original quality)
- `question`: Binary question about camera motion
- `label`: Answer ("Yes" or "No")
- `task`: Task category
- `label_name`: Detailed label identifier
## 🎬 Sample Questions and Videos
Below are animated GIF previews of sample videos from the dataset:
## πŸš€ Usage
### Loading the Dataset
```python
from datasets import load_dataset
# Load the dataset
dataset = load_dataset("cambench_binary_eval")
# Access a sample
sample = dataset['train'][0]
print(f"Question: {sample['question']}")
print(f"Answer: {sample['label']}")
print(f"Task: {sample['task']}")
# The video field contains the path to download
video_file = sample['video']
```
### Downloading Videos
Videos are embedded in the dataset. To download and use them:
```python
from datasets import load_dataset
import os
import shutil
# Load the dataset
dataset = load_dataset("cambench_binary_eval")
# Download all videos to a local directory
output_dir = "downloaded_videos"
os.makedirs(output_dir, exist_ok=True)
for idx, sample in enumerate(dataset['train']):
video_name = sample['video_name']
video_data = sample['video'] # This contains the video file data
# Save video to local disk
local_path = os.path.join(output_dir, video_name)
# If video_data is a file path (during local testing)
if isinstance(video_data, str) and os.path.exists(video_data):
shutil.copy2(video_data, local_path)
else:
# Video data from HuggingFace - write bytes to file
with open(local_path, 'wb') as f:
f.write(video_data)
print(f"Downloaded: {video_name} -> {local_path}")
print(f"All {len(dataset['train'])} videos downloaded to {output_dir}/")
```
### Accessing Individual Videos
To download a specific video by name:
```python
from datasets import load_dataset
import os
dataset = load_dataset("cambench_binary_eval")
# Find and download a specific video
target_video = "your_video_name.mp4"
for sample in dataset['train']:
if sample['video_name'] == target_video:
video_data = sample['video']
# Save to current directory
with open(target_video, 'wb') as f:
f.write(video_data)
print(f"Downloaded: {target_video}")
break
else:
print(f"Video {target_video} not found in dataset")
```
### Batch Processing
For evaluation tasks:
```python
from datasets import load_dataset
dataset = load_dataset("cambench_binary_eval")
correct = 0
total = 0
for sample in dataset['train']:
video_path = sample['video']
question = sample['question']
ground_truth = sample['label']
# Your model inference here
# prediction = your_model(video_path, question)
# if prediction == ground_truth:
# correct += 1
# total += 1
# accuracy = correct / total if total > 0 else 0
# print(f"Accuracy: {accuracy:.2%}")
```
## πŸ“₯ Alternative: Download Full Dataset
To download the entire dataset with all videos at once:
```bash
# Using huggingface-cli
huggingface-cli download cambench_binary_eval --repo-type dataset --local-dir ./cambench_data
# Or using Python
from huggingface_hub import snapshot_download
snapshot_download(repo_id="cambench_binary_eval", repo_type="dataset", local_dir="./cambench_data")
```
This will download all videos and data files to your local machine.
## πŸ“Š Evaluation
This dataset is designed for binary classification tasks. Evaluate your model using:
- Accuracy
- Precision/Recall
- F1 Score
- Per-task performance
## πŸ“„ License
Please refer to the original CameraBench dataset for licensing information.
## πŸ™ Citation
If you use this dataset, please cite the original CameraBench paper.
## πŸ“§ Contact
For questions or issues, please open an issue on the repository.
---
**Note**: Videos are provided in MP4 format. Large videos (>50MB) are automatically compressed to ensure smooth downloading and processing. All videos maintain their original temporal dynamics for accurate camera motion evaluation.