Introduction

NKL (short for NanKai Lines) is a dataset for semantic line detection. Semantic lines are meaningful line structures that outline the conceptual structure of natural images.

pressue plot pressue plot pressue plot pressue plot pressue plot pressue plot pressue plot pressue plot pressue plot pressue plot pressue plot pressue plot pressue plot pressue plot pressue plot pressue plot pressue plot pressue plot
Example images and annotations of NKL dataset.

The NKL dataset contains 5,000 images of various scenes. Each of these images is annotated by multiple skilled human annotators. The dataset is split into training and validation subsets. There are 4,000 images in the training set and 1,000 in the validation set.

Statistics of NKL compared to the SEL[1] dataset.
Dataset Total
(#Images / #Lines)
Training
(#Images / #Lines)
Validation
(#Images / #Lines)
SEL [1] 1,715 / 2,791 1,541 / 2,493 174 / 298
NKL (Ours) 6,500 / 13,148 5,200 / 10,498 1,300 / 2,650

Below is the category distribution of SEL [1] and NKL datasets. Category labels are obtained by passing the images into a Places365 [2] pretrainedmodel. There are 288 (out of 365) scene labels presented in NKL dataset, in contrast to 167 in SEL dataset. The labels of NKL are also more fairly distributed compared to that of SEL [1].

Files and Annotations

The images and annotations are organised into a zip file https://kaizhao.net/deep-hough-transform/NKL.zip (MD5SUM: b4715fa6be32b021788487057d20faf2). After download and decompression, the directory structure is as below:

├── train
│   ├── 1.jpg
│   ├── 1.txt
│   ├── ...
│   └── ...
└── val
    ├── 4001.jpg
    ├── 4001.txt
    ├── ...
    └── ...

where 'xxx.txt' is the annotation.

Each annotation is a single line text file with format: n x11 y11 x12 y12 ... xn1 yn1 xn2 yn2 where n is the number of lines and xn1 yn1 xn2 yn2 are the coordinates of endpoints of the n-th line.

Below is the example code to mask the line annotations to the image for visualization:

from PIL import Image, ImageDraw
im = Image.open("1.jpg")
lines = np.loadtxt("1.txt")
N = int(lines[0])
lines = np.delete(lines, 0)
lines = np.reshape(lines, (N, 4)).astype(int)
draw = ImageDraw.Draw(im)
for l in range(N):
    draw.line(lines[l, :].tolist(), fill="red", width=4)
im.save("1-visualization.jpg")

Visualizations

Training set

pressue plot pressue plot pressue plot pressue plot pressue plot pressue plot pressue plot pressue plot pressue plot pressue plot pressue plot pressue plot

Validation set

pressue plot pressue plot pressue plot pressue plot pressue plot pressue plot pressue plot pressue plot pressue plot pressue plot pressue plot pressue plot

Bibliography:

@article{zhao2021deep,
  author    = {Kai Zhao and Qi Han and Chang-bin Zhang and Jun Xu and Ming-ming Cheng},
  title     = {Deep Hough Transform for Semantic Line Detection},
  booktitle = {IEEE Transactions on Pattern Analysis and Machine Intelligence (TPAMI)},
  year      = {2021},
  url       = {http://kaizhao.net/nkl}
}

References:

  1. Lee JT, Kim HU, Lee C, Kim CS. Semantic line detection and its applications. InProceedings of the IEEE International Conference on Computer Vision 2017 (pp. 3229-3237).
  2. Zhou, B., Lapedriza, A., Khosla, A., Oliva, A. and Torralba, A., 2017. Places: A 10 million image database for scene recognition. IEEE transactions on pattern analysis and machine intelligence, 40(6), pp.1452-1464.