Instance Segmentation labels conversion from COCO to Yolov5

Hi all,
Last week, I was struggling to convert instance segmentation labels to YOLOv5 format, to train the YOLOv5-seg models. To my knowledge, only Roboflow provides the functionality, and even for that, we have to upload our data, and if we canโ€™t pay to Upgrade, we have to make it public.
So, I have tried to write this functionality here:

Using this, we can convert instance segmentation labels in COCO 1.0 format to Yolov5 format. If it can be of use to someone, that would be amazing.
Also, do let me know, in case of any mistake, as I am not that much expert :slightly_smiling_face:
thanks