苏州做网站的公司,新品发布会宣传文案,竹子建站模板怎么下载,大型网站响应式problem formulation
有时候下载的数据集如下#xff0c;就很烦#xff0c;一个里面就一张图片
code
import os
import shutil# 定义源目录和目标目录
source_dir ./dataset/data/Detection
destination_dir ./dataset/data/img# 确保目标目录存在#xff0c;如果不存…problem formulation
有时候下载的数据集如下就很烦一个里面就一张图片
code
import os
import shutil# 定义源目录和目标目录
source_dir ./dataset/data/Detection
destination_dir ./dataset/data/img# 确保目标目录存在如果不存在则创建
if not os.path.exists(destination_dir):os.makedirs(destination_dir)# 遍历源目录及其子目录
for root, dirs, files in os.walk(source_dir):for file in files:# 检查是否为图片文件if file.endswith((.jpg, .jpeg, .png, .gif, .bmp)):# 构建完整源文件路径和目标文件路径source_file_path os.path.join(root, file)destination_file_path os.path.join(destination_dir, file)# 复制图片到目标目录shutil.copy2(source_file_path, destination_file_path)print(图片提取完成)