MCPcopy Index your code
hub / github.com/Sampson-Lee/Rail-Detection

github.com/Sampson-Lee/Rail-Detection @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
234 symbols 718 edges 31 files 8 documented · 3%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Railroad-Detection

Rail detection, essential for railroad anomaly detection, aims to identify the railroad region in video frames. Although various studies on rail detection exist, neither an open benchmark nor a high-speed network is available in the community, making algorithm comparison and development difficult. Inspired by the growth of lane detection, we propose a rail database and a row-based rail detection method.

Rail-DB

We present a real-world railway dataset, Rail-DB, with 7432 pairs of images and annotations. The images are collected from different situations in lighting, road structures, and views. The rails are labeled with polylines, and the images are categorized into nine scenes. The Rail-DB is expected to facilitate the improvement of rail detection algorithms. The collection pipeline is shown in Fig.1.

Fig.1 - image collection.

:star: DATASET You can download the dataset by filling out this form. An email with dataset download link will come to you. If the dataset is helpful to you, please give a star to this repository, thanks.

Rail-Net

We present an efficient row-based rail detection method, Rail-Net, containing a lightweight convolutional backbone and an anchor classifier. Specifically, we formulate the process of rail detection as a row-based selecting problem. This strategy reduces the computational cost compared to alternative segmentation methods.

Fig.2 - Rail-Net archetecture.

:star: train scripts

git clone git@github.com:Sampson-Lee/Rail-Detection.git
conda env create -f environment.yaml # then install your own torch
bash launch_training.sh # after specify configs/raildb.py

Experiments

We evaluate the Rail-Net on Rail-DB with extensive experiments, including cross-scene settings and network backbones ranging from ResNet to Vision Transformers. Our method achieves promising performance in terms of both speed and accuracy. Notably, a lightweight version could achieve 92.77\% accuracy and 312 frames per second. The Rail-Net outperforms the traditional method by 50.65\% and the segmentation one by 5.86\%.

Fig.3 - Quantitative and qualitative results.

:star: DEPLOY get pretrained models from here and deploy in real environments

cd utils
python deploy.py # after overide the image or video in this file

We find the pretrained model fails to generalize to many real situations (e.g., example.mp4). 😅 Therefore, we will mainly address this problem in the future work.

Citation

Do not forget to cite our work appropriately.

@inproceedings{li2022rail,
  title={Rail Detection: An Efficient Row-based Network and a New Benchmark},
  author={Li, Xinpeng and Peng, Xiaojiang},
  booktitle={Proceedings of the 30th ACM International Conference on Multimedia},
  pages={6455--6463},
  year={2022}
}

Core symbols most depended-on inside this repo

dist_print
called by 41
utils/dist_utils.py
get_train_loader
called by 34
data/dataloader.py
get
called by 16
utils/metrics.py
add_scalar
called by 12
utils/dist_utils.py
validate
called by 11
train.py
can_log
called by 9
utils/dist_utils.py
dist_tqdm
called by 6
utils/dist_utils.py
step
called by 6
utils/factory.py

Shape

Method 119
Function 74
Class 41

Languages

Python100%

Modules by API surface

utils/config.py29 symbols
data/mytransforms.py27 symbols
utils/metrics.py22 symbols
utils/dist_utils.py20 symbols
hand-crafted/hand_utils.py19 symbols
segmentation/model_seg.py17 symbols
model/backbone.py16 symbols
utils/loss.py12 symbols
utils/factory.py12 symbols
data/dataset.py11 symbols
model/model.py8 symbols
utils/common.py7 symbols

For agents

$ claude mcp add Rail-Detection \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact