Faster RCNN Hierarchical Classification Head

I’m using faster-rcnn to detect animals in images and I would like my classification head to output scores for a number of sub-categories, for example it might output 0.9 for animal, then 0.6 for dog, then 0.3 for poodle. I am wondering if it is possible to replace the classification head of Faster RCNN with a hierarchical classification network, such as that described here: GitHub - Ugenteraan/Deep_Hierarchical_Classification: PyTorch Implementation of Deep Hierarchical Classification for Category Prediction in E-commerce System. If it is possible, could I get some guidance on how this might be done.

Thank you for your time!