Skip to content

Instantly share code, notes, and snippets.

@nbswords
Created June 26, 2021 09:19
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 nbswords/c4076a5f12b983b11deed66af589e99b to your computer and use it in GitHub Desktop.
Save nbswords/c4076a5f12b983b11deed66af589e99b to your computer and use it in GitHub Desktop.
import os
image_files = []
os.chdir(os.path.join("data", "obj"))
for filename in os.listdir(os.getcwd()):
if filename.endswith(".jpg"):
image_files.append("data/obj/" + filename)
os.chdir("..")
with open("train.txt", "w") as outfile:
for image in image_files:
outfile.write(image)
outfile.write("\n")
outfile.close()
os.chdir("..")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment