Commit ·
d650f60
1
Parent(s): e3c4fa8
updates
Browse files- data_curation.py +2 -3
- script.py +5 -5
data_curation.py
CHANGED
|
@@ -21,7 +21,7 @@ def take_random_sample(dataset):
|
|
| 21 |
"""Take a sample from the dataset"""
|
| 22 |
return dataset.take(size=10,seed=51)
|
| 23 |
|
| 24 |
-
def prepare_dataset(name):
|
| 25 |
"""
|
| 26 |
Prepare the dataset for model training.
|
| 27 |
|
|
@@ -57,5 +57,4 @@ def prepare_dataset(name):
|
|
| 57 |
dataset = take_random_sample(dataset)
|
| 58 |
|
| 59 |
# Return the curated dataset
|
| 60 |
-
curated_dataset = dataset.clone()
|
| 61 |
-
return curated_dataset
|
|
|
|
| 21 |
"""Take a sample from the dataset"""
|
| 22 |
return dataset.take(size=10,seed=51)
|
| 23 |
|
| 24 |
+
def prepare_dataset(name="Voxel51/Data-Centric-Visual-AI-Challenge-Train-Set"):
|
| 25 |
"""
|
| 26 |
Prepare the dataset for model training.
|
| 27 |
|
|
|
|
| 57 |
dataset = take_random_sample(dataset)
|
| 58 |
|
| 59 |
# Return the curated dataset
|
| 60 |
+
curated_dataset = dataset.clone(name="curated_dataset")
|
|
|
script.py
CHANGED
|
@@ -12,16 +12,13 @@ Your predictions must be in a label_field called "predictions" in the dataset.
|
|
| 12 |
See here for more details about hyperparameters for this model: https://docs.ultralytics.com/modes/train/#train-settings
|
| 13 |
"""
|
| 14 |
import os
|
| 15 |
-
|
| 16 |
-
from math import log
|
| 17 |
import yaml
|
| 18 |
|
| 19 |
import fiftyone as fo
|
| 20 |
import fiftyone.utils.random as four
|
| 21 |
import fiftyone.utils.huggingface as fouh
|
| 22 |
|
| 23 |
-
from ultralytics import YOLO
|
| 24 |
-
|
| 25 |
from data_curation import prepare_dataset
|
| 26 |
|
| 27 |
def export_to_yolo_format(
|
|
@@ -68,7 +65,10 @@ def train_model(training_dataset, training_config):
|
|
| 68 |
"""
|
| 69 |
Train the YOLO model on the given dataset using the provided configuration.
|
| 70 |
"""
|
| 71 |
-
|
|
|
|
|
|
|
|
|
|
| 72 |
|
| 73 |
print("Splitting the dataset...")
|
| 74 |
four.random_split(training_dataset, {"train": training_config['train_split'], "val": training_config['val_split']})
|
|
|
|
| 12 |
See here for more details about hyperparameters for this model: https://docs.ultralytics.com/modes/train/#train-settings
|
| 13 |
"""
|
| 14 |
import os
|
| 15 |
+
|
|
|
|
| 16 |
import yaml
|
| 17 |
|
| 18 |
import fiftyone as fo
|
| 19 |
import fiftyone.utils.random as four
|
| 20 |
import fiftyone.utils.huggingface as fouh
|
| 21 |
|
|
|
|
|
|
|
| 22 |
from data_curation import prepare_dataset
|
| 23 |
|
| 24 |
def export_to_yolo_format(
|
|
|
|
| 65 |
"""
|
| 66 |
Train the YOLO model on the given dataset using the provided configuration.
|
| 67 |
"""
|
| 68 |
+
training_dataset = fouh.load_from_hub(
|
| 69 |
+
"Voxel51/Data-Centric-Visual-AI-Challenge-Train-Set",
|
| 70 |
+
max_samples=100 #for testing remove this later
|
| 71 |
+
)
|
| 72 |
|
| 73 |
print("Splitting the dataset...")
|
| 74 |
four.random_split(training_dataset, {"train": training_config['train_split'], "val": training_config['val_split']})
|