Multitask model based on YoloV5

Hi, I want to create a multitask deep learning model, based on the architecture of yolov5. My model should have a classification head, a segmentation head, and multiple detection heads. Any idea how I should create this network? Can change the YAML configuration file, or create the network from scratch, considering that the YoloV5 architecture is not completely sequential?
Is it also possible to train the different heads separately and then transfer the weights to the aggregated model?