Ray tune with Yolo #10371
Replies: 2 comments 1 reply
-
@Coder-Vishali not yet, but if you have luck with it please consider creating a tutorial for other users! |
Beta Was this translation helpful? Give feedback.
-
Hello :) I have managed to make RayTune work with YOLOV5, by restructuring the code that is used to train the model. First, I considered the RayTune implementation in YOLOv8, specifically the function run_ray_tune(). You see that the function accepts, among a few others, a model and train-args as its arguments. And inside the same function, at this line, you see that the function is defined which starts training of the model here . So, this hinted me to restructure the train,py function to make it work. Therefore, secondly I looked at the train.py function and I realized that inside of it, whenever it is called, a new model is instantiated, and then this model is subsequently trained. I thought that such approach would be a bit redundant for tuning so I purposefully took out this part from model training, and made it so that a model is created using another external function (using exactly the same code as inside train.py) As for the training arguments, instead of the argument parser, I changed the training function so that these arguments can be passed manually in my Python script, rather than inside a terminal. So, the training script in its most general way should be something like;
So now that you have a function that makes a model, and a function that trains a model based on the input training arguments, you can use this in the _run_ray_tune quite easily. Following the principle of v8 implementation, instead of running I hope you manage to make it work based off my explanation. I am still making the code a bit pretty, and soon I will share the code with the community. Kind regards, |
Beta Was this translation helpful? Give feedback.
-
I like to know if anyone have used ray tune hyperparameter tuning with YOLO models. If yes, please share me some pointers.
Beta Was this translation helpful? Give feedback.
All reactions