ai-station-code/wudingpv/taihuyuan_pv/dataloaders/datasets/otherperations.py

36 lines
903 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@project:
@File : otherperations
@Author : qiqq
@create_time : 2023/10/8 11:03
"""
import os
'''
根据bat最原始版本 和非bat新版本之间的差集 删除 相应的原图和标签
'''
#pv
basedir="/home/qiqq/q3dl/datalinan/taihuyuan_pv/"
with open("/home/qiqq/q3dl/datalinan/taihuyuan_pv/trainbat.txt" ,'r') as f1:
pvssource =[ i.strip("\n") for i in f1.readlines()]
with open("/home/qiqq/q3dl/datalinan/taihuyuan_pv/train.txt" ,'r') as f2:
pvn =[ i.strip("\n") for i in f2.readlines()]
pvvv=list(set(pvn).difference(set(pvssource))) # b中有而a中没有的
print(len(pvvv))
print(pvvv)
for i in pvvv:
imgpa=os.path.join(basedir,'images',i+'.png')
labelpa=os.path.join(basedir,'labels',i+'.png')
os.remove(imgpa)
os.remove(labelpa)
print("Wancheng")