forked from saurabhjha004/Crop-Disease-Detection
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdata.py
More file actions
25 lines (20 loc) · 777 Bytes
/
data.py
File metadata and controls
25 lines (20 loc) · 777 Bytes
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
import os
import shutil
from sklearn.model_selection import train_test_split
def split_dataset():
original_data_dir = "Data"
train_dir = "dataset/train"
val_dir = "dataset/validation"
test_dir = "dataset/test"
os.makedirs(train_dir, exist_ok=True)
os.makedirs(val_dir, exist_ok=True)
os.makedirs(test_dir, exist_ok=True)
subfolders = ["augmented", "non-augmented"]
for subfolder in subfolders:
subfolder_path = os.path.join(original_data_dir, subfolder)
if not os.path.isdir(subfolder_path):
print(f"Skipping missing subfolder: {subfolder}")
continue
categories = os.listdir(subfolder_path)
#Abhishek's Part
print("Dataset split complete!")