Skip to content

Instantly share code, notes, and snippets.

@aliyevorkhan
Last active March 28, 2021 11:32
Show Gist options
  • Select an option

  • Save aliyevorkhan/7f0dfff643c9a7fe9f037e570cdb04ef to your computer and use it in GitHub Desktop.

Select an option

Save aliyevorkhan/7f0dfff643c9a7fe9f037e570cdb04ef to your computer and use it in GitHub Desktop.
import glob
import sys
import os
lbls = []
frames = []
if_lbl_exists = False
for lbl in glob.glob(str(sys.argv[1])+'/*.txt'):
lbls.append(lbl.split('/')[1].split('.')[0])
for frame in glob.glob(str(sys.argv[2])+'/*.jpg'):
frames.append(frame.split('/')[1].split('.')[0])
for f in frames:
for l in lbls:
if f==l:
if_lbl_exists=True
if not if_lbl_exists:
print(f)
os.remove(str(sys.argv[2])+'/'+str(f)+'.jpg')
if_lbl_exists=False
@aliyevorkhan
Copy link
Copy Markdown
Author

it can usable for yolo format label cleaning

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment