Skip to content

Instantly share code, notes, and snippets.

@audstanley
Created February 17, 2018 20:46
Show Gist options
  • Select an option

  • Save audstanley/39d5e1ab576a0b4f54c4cd09dd66a46c to your computer and use it in GitHub Desktop.

Select an option

Save audstanley/39d5e1ab576a0b4f54c4cd09dd66a46c to your computer and use it in GitHub Desktop.
Rename images for object Detection
from glob import glob
from os import rename
prefix = "tball"
count = 0
for f in glob("*.jpg"):
# remove .jpg at the end of the filename
newFname = prefix + "_" + str(count).zfill(5) + ".jpg"
print(newFname)
rename(f, newFname)
count += 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment