Spaces:
Sleeping
Sleeping
Download utils/train_model.py from pinthoz/Analogic-Watch-Detector: direct link, hf CLI and curl.
- Browser
- Download file 620 Bytes
-
https://huggingface.co/spaces/pinthoz/Analogic-Watch-Detector/resolve/main/utils/train_model.py
- Command line
-
hf download hf://spaces/pinthoz/Analogic-Watch-Detector/utils/train_model.py
-
curl -L -o train_model.py https://huggingface.co/spaces/pinthoz/Analogic-Watch-Detector/resolve/main/utils/train_model.py
620 Bytes
| import yaml | |
| from ultralytics import YOLO | |
| def main(): | |
| file_path = "runs/detect/tune4/best_hyperparameters.yaml" | |
| with open(file_path, 'r') as file: | |
| hyperparameters = yaml.safe_load(file) | |
| print(hyperparameters) | |
| model = YOLO('yolov8s.pt') | |
| model.train( | |
| data='dataset.yaml', | |
| **hyperparameters, | |
| imgsz=768, | |
| batch=16, | |
| device=0, | |
| optimizer='adamw', | |
| plots=True, | |
| save=True, | |
| conf=0.25, | |
| iou=0.45, | |
| epochs=200, | |
| patience=20 | |
| ) | |
| if __name__ == "__main__": | |
| main() | |