学php到做网站要多久,做暧小视频免费网站,网站年费怎么做分录,云南网站设计定制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(图片提取完成)