Skip to content

Instantly share code, notes, and snippets.

@ahmedbilal
Created March 12, 2019 20:20
Show Gist options
  • Save ahmedbilal/ca5015d6630769e3bba8d4b8acb2758c to your computer and use it in GitHub Desktop.
Save ahmedbilal/ca5015d6630769e3bba8d4b8acb2758c to your computer and use it in GitHub Desktop.
Verify annotation[.txt] obtained from cvat_xml_to_txt.py
import cv2
import os
import argparse
arg_parser = argparse.ArgumentParser()
arg_parser.add_argument("--input", type=str, help="Input annotation[.txt] file path",
dest="input_file", required=True)
args = arg_parser.parse_args()
with open(args.input_file, "r") as f:
for line in f.readlines():
filename, xa, ya, xb, yb, label = line.split(",")
xa = int(xa)
ya = int(ya)
xb = int(xb)
yb = int(yb)
frame = cv2.imread(filename)
frame = cv2.imread(filename)
frame = cv2.rectangle(frame, (xa, ya), (xb, yb), (0, 100, 223), 5)
cv2.imshow(filename, frame)
if cv2.waitKey(25) & 0xFF == ord('q'):
break
cv2.destroyAllWindows()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment