YOLOX icon indicating copy to clipboard operation
YOLOX copied to clipboard

Possibility of just training the cls line?

Open airpods69 opened this issue 2 years ago • 1 comments

I am trying to train an object detection model using only image classification dataset. image Is it possible to train the image in this manner such that during training we just dont touch or deal with the bounding boxes at all (Kinda like training an image classifier).

airpods69 avatar Jul 09 '23 18:07 airpods69

So you mean to train the same architecture but to ignore the regression branch? If yes then you can modify the code to only output cls_loss in the total_loss dictionary, that way the backwards pass will ignore other losses and won't update the layers.

https://github.com/Megvii-BaseDetection/YOLOX/blob/ac58e0a5e68e57454b7b9ac822aced493b553c53/yolox/models/yolo_head.py#L404C7-L404C7

P.S. I haven't tested this with the yolox training scripts(maybe instead of using total loss, they get the losses one by one from dictionary) but if you setup a regular training script that should work.

P. P. S. I believe simply going line by line and rewriting the architecture to only have classification branch is better if you are doing this for education purposes, because just returning only classification loss will be inefficient(think of all the calculations done for regression branch which will get discarded)

Isalia20 avatar Aug 11 '23 13:08 Isalia20