copilot-swe-agent[bot] kr4phy commited on
Commit
c15d55f
ยท
1 Parent(s): 4ae3a76

Update CLI and documentation for new methods

Browse files

Co-authored-by: kr4phy <168257476+kr4phy@users.noreply.github.com>

Files changed (2) hide show
  1. README.md +63 -24
  2. cli.py +10 -6
README.md CHANGED
@@ -8,10 +8,12 @@ This project is a demo application that detects lane lines in videos using OpenC
8
 
9
  ## ๊ธฐ๋Šฅ (Features)
10
  - ๐ŸŽฅ Gradio๋ฅผ ํ†ตํ•œ ๋น„๋””์˜ค ์—…๋กœ๋“œ (Video upload via Gradio)
11
- - ๐Ÿ›ฃ๏ธ OpenCV๋ฅผ ์ด์šฉํ•œ ์‹ค์‹œ๊ฐ„ ์ฐจ์„  ๊ฒ€์ถœ (Real-time lane detection using OpenCV)
12
  - ๐Ÿ“Š ์›๋ณธ/์ฒ˜๋ฆฌ ๋น„๋””์˜ค ์‚ฌ์ด๋“œ๋ฐ”์ด์‚ฌ์ด๋“œ ๋น„๊ต (Side-by-side comparison of original and processed videos)
 
13
  - ๐Ÿ’ป CLI ๋„๊ตฌ ์ œ๊ณต (Command-line interface available)
14
  - ๐Ÿงช ํฌ๊ด„์ ์ธ ํ…Œ์ŠคํŠธ ์Šค์œ„ํŠธ (Comprehensive test suite)
 
15
 
16
  ## ์„ค์น˜ (Installation)
17
 
@@ -47,7 +49,7 @@ python app.py
47
  ### ๋ฐฉ๋ฒ• 2: CLI ์‚ฌ์šฉ (Using Command Line)
48
 
49
  ```bash
50
- python cli.py input_video.mp4 output_video.mp4
51
  ```
52
 
53
  ์˜ˆ์‹œ (Example):
@@ -55,32 +57,69 @@ python cli.py input_video.mp4 output_video.mp4
55
  # ํ…Œ์ŠคํŠธ ๋น„๋””์˜ค ์ƒ์„ฑ (Create test video)
56
  python create_test_video.py
57
 
58
- # ์ฐจ์„  ๊ฐ์ง€ ์ฒ˜๋ฆฌ (Process with lane detection)
59
- python cli.py /tmp/test_road_video.mp4 result.mp4
 
 
 
 
 
60
  ```
61
 
62
  ## ์ฐจ์„  ๊ฐ์ง€ ์•Œ๊ณ ๋ฆฌ์ฆ˜ (Lane Detection Algorithm)
63
 
64
- ๋ณธ ํ”„๋กœ์ ํŠธ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์€ ์ปดํ“จํ„ฐ ๋น„์ „ ๊ธฐ๋ฒ•์„ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค:
65
- (This project uses the following computer vision techniques:)
66
-
67
- 1. **Grayscale ๋ณ€ํ™˜** (Convert to grayscale)
68
- - ์ปฌ๋Ÿฌ ์ด๋ฏธ์ง€๋ฅผ ํ‘๋ฐฑ์œผ๋กœ ๋ณ€ํ™˜ํ•˜์—ฌ ์ฒ˜๋ฆฌ ์†๋„ ํ–ฅ์ƒ
69
-
70
- 2. **๊ฐ€์šฐ์‹œ์•ˆ ๋ธ”๋Ÿฌ** (Gaussian blur)
71
- - ๋…ธ์ด์ฆˆ ์ œ๊ฑฐ ๋ฐ ์—์ง€ ๊ฒ€์ถœ ์„ฑ๋Šฅ ํ–ฅ์ƒ
72
-
73
- 3. **Canny ์—์ง€ ๊ฒ€์ถœ** (Canny edge detection)
74
- - ์ด๋ฏธ์ง€์—์„œ ๊ฐ€์žฅ์ž๋ฆฌ(edge) ๊ฒ€์ถœ
75
-
76
- 4. **๊ด€์‹ฌ ์˜์—ญ(ROI) ๋งˆ์Šคํ‚น** (Region of Interest masking)
77
- - ๋„๋กœ ์˜์—ญ์—๋งŒ ์ง‘์ค‘ํ•˜์—ฌ ๋ถˆํ•„์š”ํ•œ ์˜์—ญ ์ œ์™ธ
78
-
79
- 5. **Hough ๋ณ€ํ™˜** (Hough transform)
80
- - ์ง์„  ํ˜•ํƒœ์˜ ์ฐจ์„  ๊ฒ€์ถœ
81
-
82
- 6. **์ฐจ์„  ํ‰๊ท ํ™” ๋ฐ ๊ทธ๋ฆฌ๊ธฐ** (Lane averaging and drawing)
83
- - ๊ฒ€์ถœ๋œ ์—ฌ๋Ÿฌ ์„ ๋ถ„์„ ํ‰๊ท ํ™”ํ•˜์—ฌ ์•ˆ์ •์ ์ธ ์ฐจ์„  ํ‘œ์‹œ
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
 
85
  ## ํ”„๋กœ์ ํŠธ ๊ตฌ์กฐ (Project Structure)
86
 
 
8
 
9
  ## ๊ธฐ๋Šฅ (Features)
10
  - ๐ŸŽฅ Gradio๋ฅผ ํ†ตํ•œ ๋น„๋””์˜ค ์—…๋กœ๋“œ (Video upload via Gradio)
11
+ - ๐Ÿ›ฃ๏ธ 6๊ฐ€์ง€ ์ฐจ์„  ๊ฒ€์ถœ ๋ฐฉ๋ฒ• ์ œ๊ณต (6 lane detection methods available)
12
  - ๐Ÿ“Š ์›๋ณธ/์ฒ˜๋ฆฌ ๋น„๋””์˜ค ์‚ฌ์ด๋“œ๋ฐ”์ด์‚ฌ์ด๋“œ ๋น„๊ต (Side-by-side comparison of original and processed videos)
13
+ - ๐Ÿ“ˆ ์‹ค์‹œ๊ฐ„ ์ง„ํ–‰ ์ƒํ™ฉ ํ‘œ์‹œ (Real-time progress tracking with progress bar)
14
  - ๐Ÿ’ป CLI ๋„๊ตฌ ์ œ๊ณต (Command-line interface available)
15
  - ๐Ÿงช ํฌ๊ด„์ ์ธ ํ…Œ์ŠคํŠธ ์Šค์œ„ํŠธ (Comprehensive test suite)
16
+ - โšก GPU ๊ฐ€์† ์ง€์› (GPU acceleration support when available)
17
 
18
  ## ์„ค์น˜ (Installation)
19
 
 
49
  ### ๋ฐฉ๋ฒ• 2: CLI ์‚ฌ์šฉ (Using Command Line)
50
 
51
  ```bash
52
+ python cli.py input_video.mp4 output_video.mp4 [method]
53
  ```
54
 
55
  ์˜ˆ์‹œ (Example):
 
57
  # ํ…Œ์ŠคํŠธ ๋น„๋””์˜ค ์ƒ์„ฑ (Create test video)
58
  python create_test_video.py
59
 
60
+ # ๋‹ค์–‘ํ•œ ๋ฐฉ๋ฒ•์œผ๋กœ ์ฐจ์„  ๊ฐ์ง€ ์ฒ˜๋ฆฌ (Process with different methods)
61
+ python cli.py /tmp/test_road_video.mp4 result_advanced.mp4 advanced
62
+ python cli.py /tmp/test_road_video.mp4 result_yolop.mp4 yolop
63
+ python cli.py /tmp/test_road_video.mp4 result_ufld.mp4 ufld
64
+ python cli.py /tmp/test_road_video.mp4 result_scnn.mp4 scnn
65
+ python cli.py /tmp/test_road_video.mp4 result_basic.mp4 basic_standard
66
+ python cli.py /tmp/test_road_video.mp4 result_segmented.mp4 basic_segmented
67
  ```
68
 
69
  ## ์ฐจ์„  ๊ฐ์ง€ ์•Œ๊ณ ๋ฆฌ์ฆ˜ (Lane Detection Algorithm)
70
 
71
+ ๋ณธ ํ”„๋กœ์ ํŠธ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์€ 6๊ฐ€์ง€ ์ฐจ์„  ๊ฐ์ง€ ๋ฐฉ๋ฒ•์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค:
72
+ (This project provides 6 lane detection methods:)
73
+
74
+ ### 1. **Basic Standard (Hough Transform)**
75
+ - Grayscale ๋ณ€ํ™˜ ๋ฐ ๊ฐ€์šฐ์‹œ์•ˆ ๋ธ”๋Ÿฌ
76
+ - Canny ์—์ง€ ๊ฒ€์ถœ
77
+ - Hough ๋ณ€ํ™˜์„ ํ†ตํ•œ ์ง์„  ๊ฒ€์ถœ
78
+ - ๋‹จ์ผ ํ‰๊ท ํ™”๋œ ์ฐจ์„  ํ‘œ์‹œ
79
+ - **์žฅ์ **: ๊ฐ€์žฅ ๋น ๋ฅธ ์ฒ˜๋ฆฌ ์†๋„
80
+ - **๋‹จ์ **: ๊ณก์„  ๋„๋กœ์—์„œ ์ •ํ™•๋„ ๋‚ฎ์Œ
81
+
82
+ ### 2. **Basic Segmented (Hough Transform)**
83
+ - Basic Standard์™€ ๋™์ผํ•œ ๊ธฐ๋ณธ ์ฒ˜๋ฆฌ
84
+ - ์—ฌ๋Ÿฌ ์„ ๋ถ„์œผ๋กœ ์ฐจ์„  ํ‘œํ˜„
85
+ - **์žฅ์ **: ๊ณก์„  ํ‘œํ˜„ ๊ฐœ์„ , ๋น ๋ฅธ ์ฒ˜๋ฆฌ
86
+ - **๋‹จ์ **: ๋ณต์žกํ•œ ์ฐจ์„ ์—์„œ๋Š” ํ•œ๊ณ„
87
+
88
+ ### 3. **Advanced (Perspective Transform + Polynomial)**
89
+ - ์›๊ทผ ๋ณ€ํ™˜์œผ๋กœ bird's eye view ์ƒ์„ฑ
90
+ - CLAHE๋ฅผ ์ด์šฉํ•œ ํ–ฅ์ƒ๋œ ๋Œ€๋น„ ๊ฐœ์„ 
91
+ - ์Šฌ๋ผ์ด๋”ฉ ์œˆ๋„์šฐ๋ฅผ ํ†ตํ•œ ๋‹คํ•ญ์‹ ํ”ผํŒ…
92
+ - ๊ทธ๋ž˜๋””์–ธํŠธ ๋ฐฉํ–ฅ ํ•„ํ„ฐ๋ง
93
+ - **์žฅ์ **: ๋†’์€ ์ •ํ™•๋„, ๊ณก์„  ๋ฐ ์ ์„  ์ฐจ์„  ์šฐ์ˆ˜
94
+ - **๋‹จ์ **: ์ฒ˜๋ฆฌ ์†๋„๊ฐ€ ๋А๋ฆผ
95
+
96
+ ### 4. **YOLOP (Multi-task Learning)**
97
+ - YOLOP (You Only Look Once for Panoptic Driving) ์˜๊ฐ
98
+ - ๋‹ค์ค‘ ์ƒ‰์ƒ ์ฐจ์„  ๊ฒ€์ถœ (ํฐ์ƒ‰, ๋…ธ๋ž€์ƒ‰)
99
+ - ์ปจํˆฌ์–ด ๊ธฐ๋ฐ˜ ์„ธ๊ทธ๋ฉ˜ํ…Œ์ด์…˜
100
+ - **์žฅ์ **: ๋‹ค์–‘ํ•œ ์ฐจ์„  ์ƒ‰์ƒ ์ธ์‹, ๋น ๋ฅธ ์ฒ˜๋ฆฌ
101
+ - **๋‹จ์ **: ๋ณต์žกํ•œ ๋„๋กœ ํ™˜๊ฒฝ์—์„œ ์ •ํ™•๋„ ์ €ํ•˜
102
+
103
+ ### 5. **UFLD (Ultra Fast Lane Detection)**
104
+ - Ultra Fast Structure-aware Deep Lane Detection ์˜๊ฐ
105
+ - ํ–‰๋ณ„ ๋ถ„๋ฅ˜ ์ ‘๊ทผ ๋ฐฉ์‹
106
+ - ์ ์‘ํ˜• ์ž„๊ณ„๊ฐ’ ์ฒ˜๋ฆฌ
107
+ - **์žฅ์ **: ์†๋„์™€ ์ •ํ™•๋„์˜ ๊ท ํ˜•, ์‹ค์‹œ๊ฐ„ ๊ฐ€๋Šฅ
108
+ - **๋‹จ์ **: ๋งค์šฐ ๋ณต์žกํ•œ ํ™˜๊ฒฝ์—์„œ๋Š” SCNN๋ณด๋‹ค ๋‚ฎ์€ ์ •ํ™•๋„
109
+
110
+ ### 6. **SCNN (Spatial CNN)**
111
+ - Spatial CNN for traffic lane detection ์˜๊ฐ
112
+ - 4๋ฐฉํ–ฅ ๊ณต๊ฐ„ ๋ฉ”์‹œ์ง€ ์ „๋‹ฌ
113
+ - ๋‹ค์ค‘ ์Šค์ผ€์ผ ์—์ง€ ๊ฒ€์ถœ
114
+ - **์žฅ์ **: ๋ณต์žกํ•œ ์‹œ๋‚˜๋ฆฌ์˜ค์—์„œ ์ตœ๊ณ  ์ •ํ™•๋„
115
+ - **๋‹จ์ **: ์ฒ˜๋ฆฌ ์‹œ๊ฐ„์ด ๋‹ค์†Œ ์†Œ์š”๋จ
116
+
117
+ ### ์•Œ๊ณ ๋ฆฌ์ฆ˜ ์„ ํƒ ๊ฐ€์ด๋“œ (Selection Guide)
118
+ - **์ตœ๊ณ  ์†๋„**: Basic Standard, YOLOP
119
+ - **๊ณก์„  ๋„๋กœ**: UFLD, Advanced, Basic Segmented
120
+ - **์ตœ๊ณ  ์ •ํ™•๋„**: SCNN, Advanced (Enhanced)
121
+ - **๋‹ค์–‘ํ•œ ์ฐจ์„  ์ƒ‰์ƒ**: YOLOP
122
+ - **๊ท ํ˜•์žกํžŒ ์„ฑ๋Šฅ**: UFLD
123
 
124
  ## ํ”„๋กœ์ ํŠธ ๊ตฌ์กฐ (Project Structure)
125
 
cli.py CHANGED
@@ -14,13 +14,16 @@ def main():
14
  print("\nArguments:")
15
  print(" input_video: Path to input video file")
16
  print(" output_video: Path to output video file")
17
- print(" method: 'basic' or 'advanced' (default: advanced)")
18
  print(" enhanced: 'true' or 'false' for enhanced thresholding (default: true, advanced only)")
19
  print(" segmented: 'true' or 'false' for segmented lines (default: false, basic only)")
20
  print("\nExamples:")
21
  print(" python cli.py road_video.mp4 output_result.mp4")
22
- print(" python cli.py road_video.mp4 output_result.mp4 basic")
23
- print(" python cli.py road_video.mp4 output_result.mp4 basic false true")
 
 
 
24
  print(" python cli.py road_video.mp4 output_result.mp4 advanced true false")
25
  sys.exit(1)
26
 
@@ -31,8 +34,9 @@ def main():
31
  segmented = sys.argv[5].lower() == "true" if len(sys.argv) >= 6 else False
32
 
33
  # Validate method
34
- if method not in ["basic", "advanced"]:
35
- print(f"Error: Invalid method '{method}'. Use 'basic' or 'advanced'")
 
36
  sys.exit(1)
37
 
38
  # Check if input file exists
@@ -45,7 +49,7 @@ def main():
45
  print(f"Method: {method}")
46
  if method == "advanced":
47
  print(f"Enhanced thresholding: {'enabled' if enhanced else 'disabled'}")
48
- if method == "basic":
49
  print(f"Segmented lines: {'enabled' if segmented else 'disabled'}")
50
  print("\nProcessing...")
51
 
 
14
  print("\nArguments:")
15
  print(" input_video: Path to input video file")
16
  print(" output_video: Path to output video file")
17
+ print(" method: 'basic_standard', 'basic_segmented', 'advanced', 'yolop', 'ufld', or 'scnn' (default: advanced)")
18
  print(" enhanced: 'true' or 'false' for enhanced thresholding (default: true, advanced only)")
19
  print(" segmented: 'true' or 'false' for segmented lines (default: false, basic only)")
20
  print("\nExamples:")
21
  print(" python cli.py road_video.mp4 output_result.mp4")
22
+ print(" python cli.py road_video.mp4 output_result.mp4 yolop")
23
+ print(" python cli.py road_video.mp4 output_result.mp4 ufld")
24
+ print(" python cli.py road_video.mp4 output_result.mp4 scnn")
25
+ print(" python cli.py road_video.mp4 output_result.mp4 basic_standard")
26
+ print(" python cli.py road_video.mp4 output_result.mp4 basic_segmented")
27
  print(" python cli.py road_video.mp4 output_result.mp4 advanced true false")
28
  sys.exit(1)
29
 
 
34
  segmented = sys.argv[5].lower() == "true" if len(sys.argv) >= 6 else False
35
 
36
  # Validate method
37
+ valid_methods = ["basic_standard", "basic_segmented", "advanced", "yolop", "ufld", "scnn"]
38
+ if method not in valid_methods:
39
+ print(f"Error: Invalid method '{method}'. Use one of: {', '.join(valid_methods)}")
40
  sys.exit(1)
41
 
42
  # Check if input file exists
 
49
  print(f"Method: {method}")
50
  if method == "advanced":
51
  print(f"Enhanced thresholding: {'enabled' if enhanced else 'disabled'}")
52
+ if method in ["basic_standard", "basic_segmented"]:
53
  print(f"Segmented lines: {'enabled' if segmented else 'disabled'}")
54
  print("\nProcessing...")
55