This Python program will convert all of your pascal voc xml to txt for YOLO datasets.
Just put this file in the folder where all the xml files are stored and run the script with command promt or terminal by typing " python convert.py". Your xml files will be converted to txt files for using in YOLO. Remember to make necessary change according to your datasets like changing the class names, etc.