Can we add a loss function to yolo?

I’m planning to add a loss function to perform 3D recognition and other tasks. I’m also preparing a dataset accordingly. Is it possible to add a loss function?

Yes, you can modify, or likely in your case create a new one, the init_criterion method for the task model. Here’s the method for the detect task, and here’s the detection loss class definition. So you’d likely need to create a ThreeDModel and ThreeDLoss class follow a similar design pattern.

Do I also need to modify files like head.py, dataset.py, Loss.py, and pred.py?

You will probably need to make lots of edits to fully integrate a 3D detection model yes.