Giter Site home page Giter Site logo

line_detection's Introduction

Line detection

Wireframe dataset

The Wireframe dataset consists of 5,462 images (5,000 for training, 462 for test) of indoor and outdoor man-made scenes.
Dataset link: One Drive

Raw dataset

Each pickle (.pkl) file contains the ground truth of an image, as follow:

*.pkl  
    |-- imagename: the name of the image  
    |-- img: the image data  
    |-- points: the set of points in the wireframe, each point is represented by its (x,y)-coordinates in the image  
    |-- lines: the set of lines in the wireframe, each line is represented by the indices of its two end-points  
    |-- pointlines: the set of associated lines of each point        
    |-- pointlines_index:  line indexes of lines in 'pointlines'  
    |-- junction: the junction locations, derived from the 'points' and 'lines'  
    |-- theta: the angle values of branches of each junction

Data preparation

The script preparation_ds_wireframe generates the the input for data loader.
We will generate 2 JSON file for training process: train.json, valid.json with the structure as follow:

train.json 
    {
        "image": np.ndarray, # the image itself
        "filename": str, # Ex: 00031546.png
        "lines": List(), # list of all lines, each lines is represented as [x1, y1, x2, y2]
        "height": ..., # height of the image
        "width": ... # width of the image
    }

Alternative dataset format

|── src/
    └── data/
        └── raw/
            └── train/
                └── images/
                    ├── 0000001.png\n
                    └── 0000002.png
                └── labels/
                    ├── 0000001.txt\n
                    └── 0000002.txt
            └── tests/
                └── images/
                    ├── 0000003.png\n
                    └── 0000004.png
                └── labels/
                    ├── 0000003.txt\n
                    └── 0000004.txt

Each line of the txt file is the coordinates of one line in the corresponding image.
Example:
    File 0000001.txt:
    372.43095088, 118.95949936, 374.10025597, 212.82363129
    435.50227356, 123.33520508, 505.86045074,  -7.40013885
    ....
Interpret: (x1, y1, x2, y2)

Setup

NOTE: Right now, the dev branch is the most up-to-date.

Option 1: Install with poetry

Clone the repository and checkout dev branch:

git clone https://github.com/ToDucThanh/line_detection.git
cd line_detection
git checkout dev

Install the environments:

python -m venv venv
source venv/bin/activate
pip install -U pip setuptools
pip install poetry
poetry install --no-root

If you only want to run demo, run:

poetry install --no-root --without dev

Option 2: Install without poetry

Clone the repository and checkout dev branch:

git clone https://github.com/ToDucThanh/line_detection.git
cd line_detection
git checkout dev

Install the environments:

python -m venv venv
source venv/bin/activate
pip install -r requirements.txt

Demo

Input: image or video. Output: list of numpy array: [np.array([x1, y1, x2, y2]), ...]

Run with one image:

from workflow.line_detection_dev import LineDetectionDemo

line_detector = LineDetectionDemo(
    image_path="src/workdir/experiments/00030043.jpg"
)

outputs = line_detector.run(
    image_save_name="sample_image",
    save_dir="./src/workdir/experiments/output",
    is_saving=True,
)

The visualization is src/workdir/experiments/output/sample_image.jpg

Run with one video:

from workflow.line_detection_dev import LineDetectionDemo

line_detector = LineDetectionDemo(
    video_path="src/videos/sample_2images_20fps.mp4"
)

outputs = line_detector.run(
    image_save_name="sample_image",
    save_dir="./src/workdir/experiments/output",
    is_saving=True,
)

The visualization is src/workdir/experiments/output/sample_image_{i}.jpg

line_detection's People

Contributors

toducthanh avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.