Upload 4 files
Browse files- CTLD-day_labels.zip +3 -0
- CTLD-night_labels.zip +3 -0
- CTLD-rain_labels.zip +3 -0
- find_unlabel_img.py +35 -0
CTLD-day_labels.zip
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c68312bbdb45215d9897e2439fc351516860d8ea38657f4dda6adf07dffa984b
|
| 3 |
+
size 195603
|
CTLD-night_labels.zip
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:bcef17f65df7a9862c333fb55df1ac25e9bc060dd9e8e76308d238bf6ca4aa14
|
| 3 |
+
size 188933
|
CTLD-rain_labels.zip
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:cf7c5fd36e963dea274315a213a37aba62e386ab39d54ca51ccf5d72fd6ff9ee
|
| 3 |
+
size 100677
|
find_unlabel_img.py
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import shutil
|
| 3 |
+
import argparse
|
| 4 |
+
|
| 5 |
+
def get_filenames_without_extension(directory, extension):
|
| 6 |
+
return set([os.path.splitext(f)[0] for f in os.listdir(directory) if f.endswith(extension)])
|
| 7 |
+
|
| 8 |
+
def move_unmatched_files(image_dir, text_dir, unmatched_dir, image_ext='.png', text_ext='.txt'):
|
| 9 |
+
# Create the unmatched directory if it doesn't exist
|
| 10 |
+
if not os.path.exists(unmatched_dir):
|
| 11 |
+
os.makedirs(unmatched_dir)
|
| 12 |
+
|
| 13 |
+
# Get filenames without extension
|
| 14 |
+
image_files = get_filenames_without_extension(image_dir, image_ext)
|
| 15 |
+
text_files = get_filenames_without_extension(text_dir, text_ext)
|
| 16 |
+
|
| 17 |
+
# Find unmatched image files
|
| 18 |
+
unmatched_images = image_files - text_files
|
| 19 |
+
|
| 20 |
+
# Move unmatched images to the unmatched directory
|
| 21 |
+
for image in unmatched_images:
|
| 22 |
+
shutil.move(os.path.join(image_dir, image + image_ext),
|
| 23 |
+
os.path.join(unmatched_dir, image + image_ext))
|
| 24 |
+
|
| 25 |
+
def main():
|
| 26 |
+
parser = argparse.ArgumentParser(description='Move unmatched image files to a separate directory.')
|
| 27 |
+
parser.add_argument('image_dir', type=str, help='Directory containing image files.')
|
| 28 |
+
parser.add_argument('text_dir', type=str, help='Directory containing text files.')
|
| 29 |
+
parser.add_argument('unmatched_dir', type=str, help='Directory to move unmatched image files to.')
|
| 30 |
+
args = parser.parse_args()
|
| 31 |
+
|
| 32 |
+
move_unmatched_files(args.image_dir, args.text_dir, args.unmatched_dir)
|
| 33 |
+
|
| 34 |
+
if __name__ == "__main__":
|
| 35 |
+
main()
|