Spaces:
Sleeping
Sleeping
File size: 6,236 Bytes
e0a5f53 e05df18 e0a5f53 e05df18 e0a5f53 e05df18 e0a5f53 f5b9020 2b342d6 c15d55f 2b342d6 c15d55f 06417df c15d55f 2b342d6 06417df 2b342d6 06417df c15d55f 06417df c15d55f 06417df 2b342d6 c15d55f 06417df 2b342d6 06417df 2b342d6 06417df e05df18 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 |
---
title: OpenCVLaneDetectionDemo
emoji: ๐
colorFrom: blue
colorTo: indigo
sdk: gradio
sdk_version: 5.49.1
app_file: app.py
pinned: false
license: gpl-3.0
---
# OpenCVLaneDetectionDemo
OpenCV Lane Detection Demo with Gradio
## ๊ฐ์ (Overview)
์ด ํ๋ก์ ํธ๋ OpenCV๋ฅผ ์ฌ์ฉํ์ฌ ๋น๋์ค์์ ์ฐจ์ ์ ๊ฐ์งํ๊ณ , Gradio UI๋ฅผ ํตํด ๊ฒฐ๊ณผ๋ฅผ ์๊ฐํํ๋ ๋ฐ๋ชจ ์ ํ๋ฆฌ์ผ์ด์
์
๋๋ค.
This project is a demo application that detects lane lines in videos using OpenCV and visualizes the results through a Gradio UI.
## ๊ธฐ๋ฅ (Features)
- ๐ฅ Gradio๋ฅผ ํตํ ๋น๋์ค ์
๋ก๋ (Video upload via Gradio)
- ๐ฃ๏ธ 6๊ฐ์ง ์ฐจ์ ๊ฒ์ถ ๋ฐฉ๋ฒ ์ ๊ณต (6 lane detection methods available)
- ๐ ์๋ณธ/์ฒ๋ฆฌ ๋น๋์ค ์ฌ์ด๋๋ฐ์ด์ฌ์ด๋ ๋น๊ต (Side-by-side comparison of original and processed videos)
- ๐ ์ค์๊ฐ ์งํ ์ํฉ ํ์ (Real-time progress tracking with progress bar)
- ๐ป CLI ๋๊ตฌ ์ ๊ณต (Command-line interface available)
- ๐งช ํฌ๊ด์ ์ธ ํ
์คํธ ์ค์ํธ (Comprehensive test suite)
- โก GPU ๊ฐ์ ์ง์ (GPU acceleration support when available)
## ์ค์น (Installation)
1. ์ ์ฅ์ ํด๋ก (Clone the repository):
```bash
git clone https://github.com/kr4phy/OpenCVLaneDetectionDemo.git
cd OpenCVLaneDetectionDemo
```
2. ํ์ํ ํจํค์ง ์ค์น (Install required packages):
```bash
pip install -r requirements.txt
```
## ์ฌ์ฉ๋ฒ (Usage)
### ๋ฐฉ๋ฒ 1: Gradio UI ์ฌ์ฉ (Using Gradio UI)
1. ์ ํ๋ฆฌ์ผ์ด์
์คํ (Run the application):
```bash
python app.py
```
2. ๋ธ๋ผ์ฐ์ ์์ ์๋์ผ๋ก ์ด๋ฆฌ๋ Gradio UI์ ์ ์ํฉ๋๋ค.
(The Gradio UI will automatically open in your browser)
3. ๋น๋์ค ํ์ผ์ ์
๋ก๋ํ๊ณ "Process Video" ๋ฒํผ์ ํด๋ฆญํฉ๋๋ค.
(Upload a video file and click the "Process Video" button)
4. ์ฒ๋ฆฌ๋ ๊ฒฐ๊ณผ๋ฅผ ํ์ธํฉ๋๋ค (์ผ์ชฝ: ์๋ณธ, ์ค๋ฅธ์ชฝ: ์ฐจ์ ๊ฐ์ง ๊ฒฐ๊ณผ).
(View the processed result - left: original, right: lane detection result)
### ๋ฐฉ๋ฒ 2: CLI ์ฌ์ฉ (Using Command Line)
```bash
python cli.py input_video.mp4 output_video.mp4 [method]
```
์์ (Example):
```bash
# ํ
์คํธ ๋น๋์ค ์์ฑ (Create test video)
python create_test_video.py
# ๋ค์ํ ๋ฐฉ๋ฒ์ผ๋ก ์ฐจ์ ๊ฐ์ง ์ฒ๋ฆฌ (Process with different methods)
python cli.py /tmp/test_road_video.mp4 result_advanced.mp4 advanced
python cli.py /tmp/test_road_video.mp4 result_yolop.mp4 yolop
python cli.py /tmp/test_road_video.mp4 result_ufld.mp4 ufld
python cli.py /tmp/test_road_video.mp4 result_scnn.mp4 scnn
python cli.py /tmp/test_road_video.mp4 result_basic.mp4 basic_standard
python cli.py /tmp/test_road_video.mp4 result_segmented.mp4 basic_segmented
```
## ์ฐจ์ ๊ฐ์ง ์๊ณ ๋ฆฌ์ฆ (Lane Detection Algorithm)
๋ณธ ํ๋ก์ ํธ๋ ๋ค์๊ณผ ๊ฐ์ 6๊ฐ์ง ์ฐจ์ ๊ฐ์ง ๋ฐฉ๋ฒ์ ์ ๊ณตํฉ๋๋ค:
(This project provides 6 lane detection methods:)
### 1. **Basic Standard (Hough Transform)**
- Grayscale ๋ณํ ๋ฐ ๊ฐ์ฐ์์ ๋ธ๋ฌ
- Canny ์์ง ๊ฒ์ถ
- Hough ๋ณํ์ ํตํ ์ง์ ๊ฒ์ถ
- ๋จ์ผ ํ๊ท ํ๋ ์ฐจ์ ํ์
- **์ฅ์ **: ๊ฐ์ฅ ๋น ๋ฅธ ์ฒ๋ฆฌ ์๋
- **๋จ์ **: ๊ณก์ ๋๋ก์์ ์ ํ๋ ๋ฎ์
### 2. **Basic Segmented (Hough Transform)**
- Basic Standard์ ๋์ผํ ๊ธฐ๋ณธ ์ฒ๋ฆฌ
- ์ฌ๋ฌ ์ ๋ถ์ผ๋ก ์ฐจ์ ํํ
- **์ฅ์ **: ๊ณก์ ํํ ๊ฐ์ , ๋น ๋ฅธ ์ฒ๋ฆฌ
- **๋จ์ **: ๋ณต์กํ ์ฐจ์ ์์๋ ํ๊ณ
### 3. **Advanced (Perspective Transform + Polynomial)**
- ์๊ทผ ๋ณํ์ผ๋ก bird's eye view ์์ฑ
- CLAHE๋ฅผ ์ด์ฉํ ํฅ์๋ ๋๋น ๊ฐ์
- ์ฌ๋ผ์ด๋ฉ ์๋์ฐ๋ฅผ ํตํ ๋คํญ์ ํผํ
- ๊ทธ๋๋์ธํธ ๋ฐฉํฅ ํํฐ๋ง
- **์ฅ์ **: ๋์ ์ ํ๋, ๊ณก์ ๋ฐ ์ ์ ์ฐจ์ ์ฐ์
- **๋จ์ **: ์ฒ๋ฆฌ ์๋๊ฐ ๋๋ฆผ
### 4. **YOLOP (Multi-task Learning)**
- YOLOP (You Only Look Once for Panoptic Driving) ์๊ฐ
- ๋ค์ค ์์ ์ฐจ์ ๊ฒ์ถ (ํฐ์, ๋
ธ๋์)
- ์ปจํฌ์ด ๊ธฐ๋ฐ ์ธ๊ทธ๋ฉํ
์ด์
- **์ฅ์ **: ๋ค์ํ ์ฐจ์ ์์ ์ธ์, ๋น ๋ฅธ ์ฒ๋ฆฌ
- **๋จ์ **: ๋ณต์กํ ๋๋ก ํ๊ฒฝ์์ ์ ํ๋ ์ ํ
### 5. **UFLD (Ultra Fast Lane Detection)**
- Ultra Fast Structure-aware Deep Lane Detection ์๊ฐ
- ํ๋ณ ๋ถ๋ฅ ์ ๊ทผ ๋ฐฉ์
- ์ ์ํ ์๊ณ๊ฐ ์ฒ๋ฆฌ
- **์ฅ์ **: ์๋์ ์ ํ๋์ ๊ท ํ, ์ค์๊ฐ ๊ฐ๋ฅ
- **๋จ์ **: ๋งค์ฐ ๋ณต์กํ ํ๊ฒฝ์์๋ SCNN๋ณด๋ค ๋ฎ์ ์ ํ๋
### 6. **SCNN (Spatial CNN)**
- Spatial CNN for traffic lane detection ์๊ฐ
- 4๋ฐฉํฅ ๊ณต๊ฐ ๋ฉ์์ง ์ ๋ฌ
- ๋ค์ค ์ค์ผ์ผ ์์ง ๊ฒ์ถ
- **์ฅ์ **: ๋ณต์กํ ์๋๋ฆฌ์ค์์ ์ต๊ณ ์ ํ๋
- **๋จ์ **: ์ฒ๋ฆฌ ์๊ฐ์ด ๋ค์ ์์๋จ
### ์๊ณ ๋ฆฌ์ฆ ์ ํ ๊ฐ์ด๋ (Selection Guide)
- **์ต๊ณ ์๋**: Basic Standard, YOLOP
- **๊ณก์ ๋๋ก**: UFLD, Advanced, Basic Segmented
- **์ต๊ณ ์ ํ๋**: SCNN, Advanced (Enhanced)
- **๋ค์ํ ์ฐจ์ ์์**: YOLOP
- **๊ท ํ์กํ ์ฑ๋ฅ**: UFLD
## ํ๋ก์ ํธ ๊ตฌ์กฐ (Project Structure)
```
OpenCVLaneDetectionDemo/
โโโ app.py # Gradio UI ์ ํ๋ฆฌ์ผ์ด์
โโโ lane_detection.py # ํต์ฌ ์ฐจ์ ๊ฒ์ถ ๋ก์ง
โโโ cli.py # ๋ช
๋ น์ค ์ธํฐํ์ด์ค
โโโ create_test_video.py # ํ
์คํธ ๋น๋์ค ์์ฑ ๋๊ตฌ
โโโ create_sample_images.py # ์ํ ์ด๋ฏธ์ง ์์ฑ ๋๊ตฌ
โโโ test_lane_detection.py # ํ
์คํธ ์ค์ํธ
โโโ requirements.txt # Python ์์กด์ฑ
โโโ README.md # ๋ฌธ์
```
## ํ
์คํธ (Testing)
์ ์ฒด ํ
์คํธ ์ค์ํธ ์คํ:
(Run the complete test suite:)
```bash
python test_lane_detection.py
```
## ์๊ตฌ์ฌํญ (Requirements)
- Python 3.7+
- gradio>=4.0.0
- opencv-python>=4.5.0
- numpy>=1.20.0
## ๊ธฐ์ ์คํ (Tech Stack)
- **OpenCV**: ์ปดํจํฐ ๋น์ ์ฒ๋ฆฌ
- **NumPy**: ์์น ์ฐ์ฐ
- **Gradio**: ์น UI ํ๋ ์์ํฌ
## ๋ผ์ด์ ์ค (License)
MIT License
## ๊ธฐ์ฌ (Contributing)
์ด์์ ํ ๋ฆฌํ์คํธ๋ฅผ ํ์ํฉ๋๋ค!
(Issues and pull requests are welcome!)
## ๋ฌธ์ (Contact)
ํ๋ก์ ํธ์ ๋ํ ์ง๋ฌธ์ด๋ ์ ์์ฌํญ์ด ์์ผ์๋ฉด ์ด์๋ฅผ ์์ฑํด์ฃผ์ธ์.
(For questions or suggestions about the project, please create an issue.) |