|
import os |
|
|
|
label_path = "images" |
|
label_files = set([os.path.splitext(file)[0] for file in os.listdir(label_path) if file.endswith(".png")]) |
|
|
|
data_path = "conditioning_images" |
|
data_files = set([os.path.splitext(file)[0] for file in os.listdir(data_path) if file.endswith(".png")]) |
|
txt_files = set([os.path.splitext(file)[0] for file in os.listdir(data_path) if file.endswith(".txt")]) |
|
|
|
|
|
for x in label_files ^ data_files: |
|
if os.path.exists(f"conditioning_images/{x}.png"): |
|
os.remove(f"conditioning_images/{x}.png") |
|
if os.path.exists(f"conditioning_images/{x}.txt"): |
|
os.remove(f"conditioning_images/{x}.txt") |
|
|
|
if os.path.exists(f"images/{x}.png"): |
|
os.remove(f"images/{x}.png") |
|
if os.path.exists(f"images/{x}.txt"): |
|
os.remove(f"images/{x}.txt") |
|
|
|
if label_files==data_files: |
|
print("data_files") |
|
if label_files==txt_files: |
|
print("txt_files") |