-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathorganize_dataset.py
More file actions
94 lines (75 loc) · 2.79 KB
/
Copy pathorganize_dataset.py
File metadata and controls
94 lines (75 loc) · 2.79 KB
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
"""
Automatic Dataset Organizer (Updated)
Organizes Parkinson’s voice dataset from your existing structure.
"""
import os
import shutil
from pathlib import Path
def create_folder_structure():
"""Create target folders for organized dataset"""
folders = [
'voice_dataset',
'voice_dataset/healthy',
'voice_dataset/parkinson',
'models',
'models/voice_model'
]
for folder in folders:
os.makedirs(folder, exist_ok=True)
print(f"✓ Created: {folder}")
def copy_from_existing():
"""
Copy files from your existing dataset/voice folders
"""
src_base = Path("dataset/voice") # source path
dest_base = Path("voice_dataset")
healthy_src = src_base / "healthy"
parkinson_src = src_base / "parkinson"
healthy_dest = dest_base / "healthy"
parkinson_dest = dest_base / "parkinson"
copied = {"healthy": 0, "parkinson": 0}
# Copy healthy files
if healthy_src.exists():
for file in healthy_src.glob("*.wav"):
shutil.copy2(file, healthy_dest / file.name)
copied["healthy"] += 1
print(f"✓ Copied {copied['healthy']} healthy files")
# Copy parkinson files
if parkinson_src.exists():
for file in parkinson_src.glob("*.wav"):
shutil.copy2(file, parkinson_dest / file.name)
copied["parkinson"] += 1
print(f"✓ Copied {copied['parkinson']} parkinson files")
return copied
def main():
"""Main execution"""
print("\n" + "="*70)
print(" 🎤 PARKINSON'S VOICE DATASET ORGANIZER (Updated Version)")
print("="*70)
create_folder_structure()
# Check if dataset/voice exists
dataset_path = Path("dataset/voice")
if not dataset_path.exists():
print("\n❌ No 'dataset/voice' folder found.")
print("Please make sure your folder structure looks like this:")
print(" dataset/voice/healthy/")
print(" dataset/voice/parkinson/")
return
print("\n📂 Copying from existing dataset folders...")
copied = copy_from_existing()
print("\n" + "="*70)
print(" 📊 SUMMARY")
print("="*70)
print(f"✓ Healthy files copied : {copied['healthy']}")
print(f"✓ Parkinson files copied : {copied['parkinson']}")
total = copied['healthy'] + copied['parkinson']
print(f"✓ Total files : {total}")
if total > 0:
print("\n✅ Dataset organized successfully!")
print("🚀 Next: Run training using:")
print(" python train_voice_simple.py")
else:
print("\n⚠️ No .wav files found in your dataset/voice folders.")
print("Please verify your dataset paths and filenames.")
if __name__ == "__main__":
main()