|
|
@@ -1,3 +1,4 @@
|
|
|
+#!/usr/bin/env python3
|
|
|
import os
|
|
|
import glob
|
|
|
import os.path as osp
|
|
|
@@ -10,12 +11,10 @@ import matplotlib.pyplot as plt
|
|
|
|
|
|
from lcnn.utils import parmap
|
|
|
|
|
|
-PRED = "/run/media/zyc/YZBackup/Paper/ICCV2019/LCNN/logs/190320-033347-abdf9cb-hg-q2/npz/000072000/*.npz"
|
|
|
-GT = "data/q2/valid/*.npz"
|
|
|
-WF = "/data/wirebase/result/wireframe/wireframe_1_rerun-baseline_0.5_0.5/2/*.mat"
|
|
|
-AFM = "/data/wirebase/result/wireframe/afm/*.npz"
|
|
|
-IMGS = "/data/wirebase/data/v1.1/test/*.jpg"
|
|
|
-LL = "/data/bible/linelet/*.mat"
|
|
|
+GT = "data/wireframe/valid/*.npz"
|
|
|
+WF = "/data/lcnn/wirebase/result/wireframe/wireframe_1_rerun-baseline_0.5_0.5/2/*.mat"
|
|
|
+AFM = "/data/lcnn/wirebase/result/wireframe/afm/*.npz"
|
|
|
+IMGS = "/data/lcnn/wirebase/Wireframe/v1.1/test/*.jpg"
|
|
|
|
|
|
|
|
|
def imshow(im):
|
|
|
@@ -34,18 +33,12 @@ def imshow(im):
|
|
|
|
|
|
|
|
|
def main():
|
|
|
- gts = glob.glob(GT)
|
|
|
- gts.sort()
|
|
|
- afm = glob.glob(AFM)
|
|
|
- afm.sort()
|
|
|
- wf = glob.glob(WF)
|
|
|
- wf.sort()
|
|
|
- img = glob.glob(IMGS)
|
|
|
- img.sort()
|
|
|
- ll = glob.glob(LL)
|
|
|
- ll.sort()
|
|
|
-
|
|
|
- prefix = "/data/wirebase/myplot/"
|
|
|
+ gts = sorted(glob.glob(GT))
|
|
|
+ afm = sorted(glob.glob(AFM))
|
|
|
+ wf = sorted(glob.glob(WF))
|
|
|
+ img = sorted(glob.glob(IMGS))
|
|
|
+
|
|
|
+ prefix = "/data/lcnn/wirebase/myplot/"
|
|
|
os.makedirs(osp.join(prefix, "GT"), exist_ok=True)
|
|
|
os.makedirs(osp.join(prefix, "LSD"), exist_ok=True)
|
|
|
os.makedirs(osp.join(prefix, "AFM"), exist_ok=True)
|
|
|
@@ -53,7 +46,7 @@ def main():
|
|
|
os.makedirs(osp.join(prefix, "LL"), exist_ok=True)
|
|
|
|
|
|
def draw(args):
|
|
|
- i, (wf_name, gt_name, afm_name, ll_name, img_name) = args
|
|
|
+ i, (wf_name, gt_name, afm_name, img_name) = args
|
|
|
img = cv2.imread(img_name, 0)
|
|
|
lsd = cv2.createLineSegmentDetector(cv2.LSD_REFINE_ADV)
|
|
|
lsd_line, _, _, lsd_score = lsd.detect(img)
|
|
|
@@ -72,25 +65,13 @@ def main():
|
|
|
wf_line = scipy.io.loadmat(wf_name)["lines"].reshape(-1, 2, 2)
|
|
|
wf_line = wf_line[:, :, ::-1]
|
|
|
|
|
|
- ll_line = scipy.io.loadmat(wf_name)["lines"].reshape(-1, 2, 2)
|
|
|
- ll_line = ll_line[:, :, ::-1]
|
|
|
-
|
|
|
- plt.figure("LL")
|
|
|
- imshow(img)
|
|
|
- for a, b in ll_line - 0.5:
|
|
|
- plt.plot([a[1], b[1]], [a[0], b[0]], color="orange", linewidth=0.5)
|
|
|
- plt.scatter(a[1], a[0], color="#33FFFF", s=1.2, edgecolors="none", zorder=5)
|
|
|
- plt.scatter(b[1], b[0], color="#33FFFF", s=1.2, edgecolors="none", zorder=5)
|
|
|
- plt.savefig(osp.join(prefix, "LL", f"{i:05}"), dpi=500, bbox_inches=0)
|
|
|
- plt.close()
|
|
|
-
|
|
|
plt.figure("GT")
|
|
|
imshow(img)
|
|
|
for a, b in gt_line - 0.5:
|
|
|
plt.plot([a[1], b[1]], [a[0], b[0]], color="orange", linewidth=0.5)
|
|
|
plt.scatter(a[1], a[0], color="#33FFFF", s=1.2, edgecolors="none", zorder=5)
|
|
|
plt.scatter(b[1], b[0], color="#33FFFF", s=1.2, edgecolors="none", zorder=5)
|
|
|
- plt.savefig(osp.join(prefix, "GT", f"{i:05}"), dpi=500, bbox_inches=0)
|
|
|
+ plt.savefig(osp.join(prefix, "GT", f"{i:05}"), dpi=3000, bbox_inches=0)
|
|
|
plt.close()
|
|
|
|
|
|
plt.figure("LSD")
|
|
|
@@ -120,7 +101,7 @@ def main():
|
|
|
plt.savefig(osp.join(prefix, "WF", f"{i:05}"), dpi=3000, bbox_inches=0)
|
|
|
plt.close()
|
|
|
|
|
|
- parmap(draw, enumerate(zip(wf, gts, afm, ll, img)))
|
|
|
+ parmap(draw, enumerate(zip(wf, gts, afm, img)))
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|