Last active
February 18, 2020 16:19
-
-
Save THEFASHIONGEEK/788bdfdc0cbbf0b2039956aedb679c39 to your computer and use it in GitHub Desktop.
This file contains 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
combined = [] | |
for i in tqdm(range(len(folders))): | |
files = os.listdir(anno_dir + "/" + folders[i]) | |
for j in range(len(files)): | |
fname = anno_dir + "/" + folders[i] + "/" + files[j] | |
f = open(fname, 'r') | |
lines = f.readlines() | |
f.close() | |
anno = [folders[i] + "/" + ".".join(files[j].split(".")[:-1])] | |
wr = "" | |
for k in range(1, len(lines)): | |
tmp = lines[k].split(" ") | |
label = folders[i] | |
x1 = int(tmp[1]) | |
y1 = int(tmp[2]) | |
x2 = x1 + int(tmp[3]) | |
y2 = y1 + int(tmp[4]) | |
wr += str(x1) + " " + str(y1) + " " + str(x2) + " " + str(y2) + " " + label + " " | |
wr = wr[:-1] | |
if(wr != ""): | |
anno.append(wr) | |
combined.append(anno) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment