I refactored the script and made it more interactive.
Downloads COCO dataset images by category, converts COCO annotations to YOLO format and writes .txt files
python 3.7 brew install python3
pycocotools pip3 install pycococtools
requests pip3 install requests
python3 coco-to-yolo-by-category.py