sbt-idp/cope2n-ai-fi/modules/sdsvkie/scripts/common/remove_imgs.py

24 lines
777 B
Python
Raw Normal View History

2023-12-12 08:14:54 +00:00
import os
import shutil
from pathlib import Path
SRC_DIR = "/mnt/ssd1T/hoanglv/Projects/KIE/DATA/dev_model/Receipt/processed/train/sbt/batch_1"
TEST_DIR = "/mnt/ssd1T/hoanglv/Projects/KIE/sdsvkie/workdirs/sdsap_receipt/exp_9_lr5e_6_no_scheduler/sbt_txt"
# Get a list of all the files in the test directory
test_files = sorted([Path(f).stem for f in os.listdir(TEST_DIR) if ".txt" in f])
print(len(test_files))
# Create the output directory if it doesn't exist
# Move the matching files from the source directory to the output directory
i = 0
src_files = sorted(os.listdir(SRC_DIR))
print(len(src_files))
for filename in src_files:
# print(Path(filename).stem )
if Path(filename).stem not in test_files:
print(Path(filename).stem)
i+=1
print(i)