import os
# from keras.preprocessing import image
from skimage import io
# imgDir = "/home/hs/tools/rotation/YOLOv5_DOTA_OBB-master/dataliuqunwei/imgs"
imgDir = "/home/hs/tools/rotation/images"
txtDir = "/home/hs/tools/rotation/YOLOv5_DOTA_OBB-master/dataliuqunwei/txts"
xmlsList = os.listdir(imgDir)
for imgfile in xmlsList:
absolute_path = os.path.join(imgDir, imgfile)
try:
io.imread(absolute_path)
except Exception as e:
# os.remove(absolute_path)
txtname = imgfile.replace('jpg','txt')
# os.remove(os.path.join(txtDir, txtname))
print(absolute_path)
print(os.path.join(txtDir, txtname))
continue
# try:
# img= np.array(img, dtype=np.float32)
# except :
# print('corrupt img',absolute_path)
# EBB6UN7MHFHDVCFJKPTCK4H
06-06
2万+
04-23
2109
11-07