import os import shutil from shutil import copy, rmtree import random cwd = os.getcwd() data_root = cwd origin_path = os.path.join(data_root, "Anomaly") new_picture_path = r"C:\Users\sun\Desktop\data1\val\Anomaly" image = os.listdir(origin_path) for images in image: origin_picture_path = os.path.join(origin_path, images) image_name = os.path.splitext(images)[0] image_number = int(image_name[8:]) if image_number % 10 == 1: shutil.move(origin_picture_path, new_picture_path)
指定图片名称分割数据集
最新推荐文章于 2024-11-13 17:24:18 发布