I have a text recognition task, where I want to have a variable number of output branches on the neural network architecture depending on the input image. How should I structure the network along with the loss and optimizers to achieve this task