Skip to content

Instantly share code, notes, and snippets.

@xu-chris
Created May 16, 2019 14:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xu-chris/64fb96dbcecd439a255c3a48b7c53e3a to your computer and use it in GitHub Desktop.
Save xu-chris/64fb96dbcecd439a255c3a48b7c53e3a to your computer and use it in GitHub Desktop.
import os
import glob
def get_image_paths(path):
# Gather image paths
image_paths = glob.iglob(os.path.join(path, "*.png"))
# Loop through images, skip those without bounding boxes
for image_path in image_paths:
print(image_path)
path, file_extension = os.path.splitext(image_path)
bounding_box_file = path + ".txt"
# Skip data without bounding boxes
if not os.path.isfile(bounding_box_file):
continue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment