# -*- coding: utf-8 -*-
import shutil
import os
def objFileName():
local_file_name_list = "/export/liuzhe/program/detection/yolov5_distill/VOCdevkit/VOC2007/val.txt"
obj_name_list = []
for i in open(local_file_name_list, 'r'):
obj_name_list.append(i.replace('\n', ''))
return obj_name_list
def copy_img():
local_img_name = r'/export/liuzhe/program/detection/yolov5_distill/VOCdevkit/VOC2007/JPEGImages'
# 指定要复制的图片路径
path = r'/export/liuzhe/program/detection/yolov5_distill/VOCdevkit/VOC2007/images/val'
# 指定存放图片的目录
for i in objFileName():
new_obj_name = i
dir, file = os.path.split(new_obj_name)
shutil.copy(new_obj_name, path + '/' + file)
if __name__ == '__main__':
copy_img()
版权声明:本文为CSDN博主「cv_lz」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qq_42250789/article/details/122660200
暂无评论