Replies: 1 comment
-
👋 Hello @Ishfaz, thank you for sharing your implementation and engaging with the Ultralytics community 🚀! Your use of Fast Geometric Ensembling (FGE) and custom learning rate schedulers with YOLOv8 is very interesting 🌊. We recommend exploring our Docs for insights into custom training and callback usage. Below are some pointers that might be helpful: 1️⃣ Custom Training and Callbacks: If this is a ❓ custom training question, you may want to verify that your custom scheduler and callback are being properly recognized during the training loop. Please review the documentation on custom training logic for additional guidance. 2️⃣ Bug Report: If this is a 🐛 bug or you're encountering unexpected behavior, we kindly ask that you provide a minimum reproducible example (MRE). Having an MRE greatly helps us debug the issue more effectively. 3️⃣ Learning Rate Adjustment: To modify the learning rate dynamically during training, consider reviewing how YOLOv8 handles its built-in schedulers and callbacks. The base YOLO object may already provide mechanisms you can integrate with or extend. Your example implementation seems like a good start. To clarify model saving intervals or other cyclical logic, you might find it helpful to review YOLOv8's callbacks or even its source code to ensure full compatibility. UpgradeBefore diving deeper, ensure you have the latest version of the pip install -U ultralytics Suggested EnvironmentsHere’s where you can try out your custom implementation in a verified environment with dependencies pre-installed. Just click and start coding:
Community and SupportJoin our active Ultralytics community 🎧 to get real-time help: An Ultralytics engineer will review this discussion soon and provide additional assistance. Stay tuned! 🚀 |
Beta Was this translation helpful? Give feedback.
-
I am working on implementing Fast Geometric Ensembling (FGE) with YOLOv8. :
from ultralytics import YOLO
import torch
import math
class FGEScheduler:
def init(self, optimizer, max_lr=1e-3, min_lr=1e-4, cycle_length=10):
self.optimizer = optimizer
self.max_lr = max_lr
self.min_lr = min_lr
self.cycle_length = cycle_length
self.current_step = 0
class FGECallback:
def init(self, save_dir='runs/fge', cycle_length=10):
self.save_dir = save_dir
self.cycle_length = cycle_length
self.current_step = 0
self.models = []
def train_fge(model, data_yaml, epochs=100, cycle_length=10):
# Initialize base model
model = YOLO(model)
Is this the correct way to implement a custom learning rate scheduler with YOLOv8? Should I use a different approach to modify the learning rate during training?
How can I properly integrate the FGE callback with YOLOv8's training loop to save model snapshots at the right cyclical intervals?
What's the best way to combine predictions from multiple snapshots for inference with the ensemble?
Beta Was this translation helpful? Give feedback.
All reactions