Giter Site home page Giter Site logo

ze-yang / lane-detection-with-erfnet Goto Github PK

View Code? Open in Web Editor NEW
63.0 2.0 15.0 25.93 MB

Paddle Implementation for 2020 China Hualu Cup Data Lake Algorithm Competition co-hosted with Baidu AI (1st Place for Lane Detection Track) 2020**华录杯·数据湖算法大赛(百度AI协办)—车道线识别赛道

License: Apache License 2.0

Python 100.00%
lane-detection paddlepaddle erfnet segmentation

lane-detection-with-erfnet's Introduction

Code for 2020 China Hualu Cup Data Lake Algorithm Competition (Lane Detection Track)

Introduction

This repo contains the first place solution by the Incredible@NTU team for the Lane Detection Track of the 2020 China Hualu Cup Data Lake Algorithm Competition. For more information about this task, we refer you to the official website. In this competion, We adopt the ERFNet as our base model for its lightweight and large receptive field, which are critical factors in this task. Furthermore, we perform data cleaning, sky removing and weighted crossentropy loss as the main techniques along with several other tricks to achieve the compelling performance (42.25 mIoU on Final testB) in a highly efficient manner. No model ensemble is used in our solution. Finally, our solution won the champion out of 576 teams in this competition. An overview of our solution is available here (passwd: shid).

Updates

  • Add visualization.py for label visualization. See utils/README.md for details. (04/01/2021)

Contents

  1. Installation
  2. Datasets
  3. Training
  4. Evaluation

Installation

Notes:

  • It may also run well on other versions but with no guarantee.

  • TensorBoard is optional, just for recording training process. If not installed, feel free to comment relevant lines of code.

  • pycocotools is only required for visualization in utils/visualization.py.

For your convenience, we wrap up the installation process with the following commands.

conda create -n paddle python=3.7 -y && conda activate paddle
pip install opencv-python==4.2.0.32
python -m pip install paddlepaddle-gpu==1.8.5.post107 -i https://mirror.baidu.com/pypi/simple
pip install pycocotools

Datasets

We first construct our training set by combining the training data released in the preliminary and final round, which consists of 15,503 training images in total. After that, data cleaning and preprocessing techniques (as described below) are conducted to obtain higher quality training samples, resulting in 15,170 training images finally.

  1. We manually filter out or re-label those wrongly annotated images. It can be roughly divided into three types, i.e., wrong annotation, wrong class label and miss label. For wrong annotation, it's shown on the left that a weird triangle (green) appears in the middle of the image with no actual lanes annotated. In the middle, the left-dashed-right-solid line (highlighted in yellow) is annotated as left-solid-right-dashed one, which is deemed as wrong class label. The last image belongs to miss label case since the dashed yellow line is missed.
  2. There also exists some duplicate images with different annotation label maps. In this case, we manually select the one we regard owns the best annotation map and ignore all the rest.
  3. We resize all the images to the same size of 1280*720 to reduce data loading time.

wrongly annotated examples

We assume the directory layout for the competition dataset PreliminaryData as below.

Project_ROOT
└── datasets
    ├── __init__.py
    ├── lane_det.py
    └── PreliminaryData
        ├── train_pic            # contains training images
        │   ├── 10008283.jpg
        │   ├── ...
        │   └── 10024760.jpg
        ├── train_label          # contains correponding grayscale labels
        │   ├── 10008283.png
        │   ├── ...
        │   └── 10024760.png
        └── testB                # contains test images
            ├── 10014001.jpg
            ├── ...
            └── 10016129.jpg

Note: Due to copyright issues, we do not release the dataset used for the competition, feel free to adopt our method on your own dataset.

Training

To train the model, run the following command.

python train_erfnet_paddle.py --epochs 150 -b 8 --lr 0.01

By default, we train our model with batch size 8 for 150 epochs on one RTX 2080ti GPU, which takes up approximately 7,000 MB GPU memory and 24hrs to finish. Our model starts with the pretrained weights pretrained/ERFNet_pretrained.pdparams, which is converted from the released torch version pretrained weights on Cityscape dataset.

Notes:

  • If you wish to reproduce our results, please do not modify the batch size as it might impose uncertainty influence on the optimization steps.

  • It will save the outputs (models and other records) to trained/ by default. Feel free to change it to your expected directory by specifying --save-dir path/to/output.

Evaluation

To reproduce our final results, just run this command:

python test_erfnet_paddle.py

By default, it will test on our released model trained/ERFNet_trained.pdparams, which exactly obtains the final results we submitted to the evaluation server.

To evaluate the models trained by yourself, simply add the --resume augment as:

python test_erfnet_paddle.py --resume trained/erfnet_epxxx

Replace xxx with the epoch point you want to test. Note that we recommend you to test the model with the highest mIoU on the training set, which is indicated by the file trained/best_model.

The testing results (prediction maps of lane markings) will be saved in results/result by default.

License

This repo is released under the Apache 2.0 License (refer to the LICENSE file for details).

Acknowledgement

This repo is mainly based on Codes-for-Lane-Detection, many thanks to them.

Should you have any questions regarding this repo, feel free to email me at [email protected].

lane-detection-with-erfnet's People

Contributors

ascetic-monk avatar ze-yang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

lane-detection-with-erfnet's Issues

数据集

想问一下您清洗后得数据集能发一下吗?百度网盘或者谷歌Drive都行。或者有没有清洗数据集的py代码呢?如果是人工找的,那可太励志了!

保存为推理模式

我看您的保存模式文件为.pdopt和.pdparams
但是本人要做部署,需要转为onnx模式
怎么使用save_inference_model接口保存为推理模式
好像还需要动态图先转为静态图,才可以后续的保存推理模式
如今卡在这一步,对paddle不是很熟悉,如果您有时间,烦请赐教一下

black

你好,我有一个问题,我是在windows下,按照您所说的环境正确配置,然后利用给出的权重文件进行预测,中途不报错,但是最终预测的结果图片全黑,不清楚哪里的问题

Wrong Shape

can not get the right shape, I set 512x512

parser.add_argument('--img_height', default=512, type=int, help='height of input images')
parser.add_argument('--img_width', default=512, type=int, help='width of input images')

I found my input size has been changed
image

image

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.