Adding a file and feature to delete all detections from database
This commit is contained in:
@@ -189,33 +189,38 @@ def main():
|
||||
# continue and just show image
|
||||
out = draw_annotations(img.copy(), labels, alpha=args.alpha, draw_bbox_for_poly=(not args.no_bbox))
|
||||
|
||||
lclass, coords = labels[0]
|
||||
print(lclass, coords)
|
||||
bbox = coords[:4]
|
||||
print("bbox", bbox)
|
||||
bbox = np.array(bbox) * np.array([img.shape[1], img.shape[0], img.shape[1], img.shape[0]])
|
||||
yc, xc, h, w = bbox
|
||||
print("bbox", bbox)
|
||||
|
||||
# polyline = np.array(coords[4:]).reshape(-1, 2) * np.array([img.shape[1], img.shape[0]])
|
||||
polyline = np.array(coords).reshape(-1, 2) * np.array([img.shape[1], img.shape[0]])
|
||||
print("pl", coords[4:])
|
||||
print("pl", polyline)
|
||||
|
||||
# Convert BGR -> RGB for matplotlib display
|
||||
# out_rgb = cv2.cvtColor(out, cv2.COLOR_BGR2RGB)
|
||||
out_rgb = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
|
||||
# out_rgb = Image()
|
||||
plt.figure(figsize=(10, 10 * out.shape[0] / out.shape[1]))
|
||||
plt.imshow(out_rgb)
|
||||
plt.plot(polyline[:, 0], polyline[:, 1], "y", linewidth=2)
|
||||
if 0:
|
||||
plt.plot(
|
||||
[yc - h / 2, yc - h / 2, yc + h / 2, yc + h / 2, yc - h / 2],
|
||||
[xc - w / 2, xc + w / 2, xc + w / 2, xc - w / 2, xc - w / 2],
|
||||
"r",
|
||||
linewidth=2,
|
||||
)
|
||||
plt.imshow(out_rgb.transpose(1, 0, 2))
|
||||
else:
|
||||
plt.imshow(out_rgb)
|
||||
|
||||
for label in labels:
|
||||
lclass, coords = label
|
||||
# print(lclass, coords)
|
||||
bbox = coords[:4]
|
||||
# print("bbox", bbox)
|
||||
bbox = np.array(bbox) * np.array([img.shape[1], img.shape[0], img.shape[1], img.shape[0]])
|
||||
yc, xc, h, w = bbox
|
||||
# print("bbox", bbox)
|
||||
|
||||
# polyline = np.array(coords[4:]).reshape(-1, 2) * np.array([img.shape[1], img.shape[0]])
|
||||
polyline = np.array(coords).reshape(-1, 2) * np.array([img.shape[1], img.shape[0]])
|
||||
# print("pl", coords[4:])
|
||||
# print("pl", polyline)
|
||||
|
||||
# Convert BGR -> RGB for matplotlib display
|
||||
# out_rgb = cv2.cvtColor(out, cv2.COLOR_BGR2RGB)
|
||||
# out_rgb = Image()
|
||||
plt.plot(polyline[:, 0], polyline[:, 1], "y", linewidth=2)
|
||||
if 0:
|
||||
plt.plot(
|
||||
[yc - h / 2, yc - h / 2, yc + h / 2, yc + h / 2, yc - h / 2],
|
||||
[xc - w / 2, xc + w / 2, xc + w / 2, xc - w / 2, xc - w / 2],
|
||||
"r",
|
||||
linewidth=2,
|
||||
)
|
||||
|
||||
# plt.axis("off")
|
||||
plt.title(f"{img_path.name} ({lbl_path.name})")
|
||||
|
||||
Reference in New Issue
Block a user