def json_train_val(): os.makedirs(os.path.join(ROOT_DIR, "tmp")) tmp_dir = os.path.join(ROOT_DIR, "tmp") os.makedirs(os.path.join(tmp_dir, "images")) img_dir = os.path.join(tmp_dir, "images") for dir_name in os.listdir(ROOT_DIR): if not (dir_name == "tmp" or dir_name == "test"): shutil.move(os.path.join(ROOT_DIR, dir_name), os.path.join(ROOT_DIR, tmp_dir, dir_name)) create_annotations(tmp_dir, img_dir)