File size: 1,746 Bytes
fda3158
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import pandas as pd
from pathlib import Path

# Configuration parameters used in generation
CONFIG = {
    'noise_density': 0.5,
    'speckle_size': 1,
    'speed': 2,
    'direction': 'horizontal',
    'fps': 60,
    'resolution': '960x540'
}

# Read motion_only metadata
motion_df = pd.read_csv('train/motion_only/metadata.csv')
motion_df['file_name'] = 'motion_only/' + motion_df['filename']
motion_df['category'] = 'motion_only'

# Read text_fg_bg metadata
text_df = pd.read_csv('train/text_fg_bg/metadata.csv')
text_df['file_name'] = 'text_fg_bg/' + text_df['filename']
text_df['category'] = 'text_fg_bg'

# Combine
combined_df = pd.concat([motion_df, text_df], ignore_index=True)

# Add configuration columns
combined_df['noise_density'] = CONFIG['noise_density']
combined_df['speckle_size'] = CONFIG['speckle_size']
combined_df['speed'] = CONFIG['speed']
combined_df['direction'] = CONFIG['direction']
combined_df['fps'] = CONFIG['fps']
combined_df['resolution'] = CONFIG['resolution']

# Reorder columns
column_order = [
    'file_name',
    'category',
    'label',
    'text',
    'duration',
    'num_frames',
    'noise_density',
    'speckle_size',
    'speed',
    'direction',
    'fps',
    'resolution'
]

# Only keep columns that exist
column_order = [col for col in column_order if col in combined_df.columns]
combined_df = combined_df[column_order]

# Save combined metadata
combined_df.to_csv('train/metadata.csv', index=False)

print(f"✓ Combined metadata saved to train/metadata.csv")
print(f"  Total samples: {len(combined_df)}")
print(f"  Motion-only: {len(motion_df)}")
print(f"  Text videos: {len(text_df)}")
print(f"\nColumns: {', '.join(combined_df.columns)}")
print(f"\nFirst few rows:")
print(combined_df.head())