sudo apt update
sudo apt -y install software-properties-common
import os | |
import xml.etree.ElementTree as ET | |
label_dir = '/home/mahmood/Downloads/RTTS/labels_original' | |
out_dir = '/home/mahmood/Downloads/RTTS/labels' | |
label_file_paths = os.listdir(label_dir) | |
print(f'Processing ...') | |
total_difficult = 0 |
# yolo label format: class x_center y_center width height | |
import glob | |
def change_labels_index(labels_path, new_class_mappings): | |
"""Change the index of labels to match the new class mappings for yolo""" | |
for label_file in glob.glob(labels_path + "/*.txt"): | |
with open(label_file, "r") as f: | |
lines = f.readlines() | |
with open(label_file, "w") as f: | |
for line in lines: |
import glob | |
import os | |
import argparse | |
parser = argparse.ArgumentParser(description='Copy or move files') | |
parser.add_argument('--source', help='Source directory', type=str) | |
parser.add_argument('--dest', help='Destination directory', type=str) | |
parser.add_argument('-r', '--recursive', action='store_true', help='Recursive if you want to scan sub directories recursively', default=True) | |
parser.add_argument('-e', '--extensions', nargs='+', help='Extensions allowed', default=['jpg', 'png', 'gif']) | |
parser.add_argument('-c', '--copy', action='store_true', help='Copy files or move files default is copy files', default=True) |