Currently I’m working on a detection model in which there are 2 classes tanks and trucks the tank class has 38.165K instances across 11.5k images and tank has 6.802k instances across 4.5k images and I’m training it with Yolov8m so there is a huge class imbalance so how do i fix this?Do i need to change the distribution focal loss or change the class loss?what necessary steps do i need to take to make it right?
Unfortunately, I have to answer your question with a question. Do you need to fix it? It’s possible you don’t need to do anything at all. Until you train the model on the data, and check the performance, you shouldn’t try to change anything.
It’s common to think about optimizing something, but until you know it’s a problem, you shouldn’t spend the time to do it. The reason is that you could spend a lot of time/effort attempting to optimize the wrong thing or fix something that seemed like a problem, that wasn’t actually a problem.
Determine what your expect outcome(s) are for model performance (how accurate do you need it to be for your use case). Then, train your model. Assess the performance and the inference results. Doing this will help make you better informed about what, if any, changes you may need to make. Additionally, in all likelihood, you won’t need to change anything about the model directly. In most cases, annotations will need to be fixed/corrected, dataset split will need to be reshuffled, modificaiton to the dataset may be needed (remove problematic majority class images, add more minority class images, etc.), or adjustment of the training arguments (additional epochs, hyperparameter adjustments, larger imgsz, etc.). Model or loss changes are uncommonly needed.