Last active
June 1, 2021 13:26
-
-
Save kingardor/9c519585266cd4715fa1deac73743760 to your computer and use it in GitHub Desktop.
To generate train.txt/test.txt for YOLO object detection
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Usage: python3 classgen.py --input path >> train.txt | |
''' | |
import os | |
import argparse | |
def argsparser(): | |
''' | |
To use arguments from command line. | |
''' | |
parser = argparse.ArgumentParser(description='Renamer script') | |
parser.add_argument('--input', dest='input', help='Input Directory', default='path', type=str) | |
return parser.parse_args() | |
if __name__ == '__main__': | |
args = argsparser() | |
files = os.listdir(args.input) | |
for f in files: | |
if 'jpg' in f: | |
print('data/obj/' + f) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Tidy little script, just change the usage comment to
traingen.py
Cheers!