UdaraChamidu commited on
Commit
54203da
·
verified ·
1 Parent(s): 5a9f96e

Upload yolo_result.html

Browse files
Files changed (1) hide show
  1. templates/yolo_result.html +200 -0
templates/yolo_result.html ADDED
@@ -0,0 +1,200 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>YOLO Detection Result</title>
7
+ <link
8
+ rel="stylesheet"
9
+ href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css"
10
+ />
11
+ <style>
12
+ body {
13
+ background: url("https://images.unsplash.com/photo-1587574293340-73d0e176cda7")
14
+ no-repeat center center fixed;
15
+ background-size: cover;
16
+ }
17
+ .result-card {
18
+ background: rgba(255, 255, 255, 0.95);
19
+ border-radius: 15px;
20
+ padding: 30px;
21
+ box-shadow: 0px 8px 20px rgba(0, 0, 0, 0.2);
22
+ max-width: 800px;
23
+ margin: auto;
24
+ }
25
+ .result-image {
26
+ border: 3px solid #198754;
27
+ border-radius: 10px;
28
+ max-width: 100%;
29
+ max-height: 500px;
30
+ box-shadow: 0px 6px 15px rgba(0, 0, 0, 0.2);
31
+ }
32
+ .btn {
33
+ border-radius: 50px;
34
+ padding: 10px 20px;
35
+ }
36
+ .detection-badge {
37
+ display: inline-block;
38
+ margin: 5px;
39
+ padding: 8px 12px;
40
+ border-radius: 20px;
41
+ font-size: 0.9rem;
42
+ }
43
+ .confidence-high {
44
+ background-color: #d4edda;
45
+ color: #155724;
46
+ border: 1px solid #c3e6cb;
47
+ }
48
+ .confidence-medium {
49
+ background-color: #fff3cd;
50
+ color: #856404;
51
+ border: 1px solid #ffeaa7;
52
+ }
53
+ .confidence-low {
54
+ background-color: #f8d7da;
55
+ color: #721c24;
56
+ border: 1px solid #f5c6cb;
57
+ }
58
+
59
+ .image-comparison {
60
+ display: flex;
61
+ gap: 20px;
62
+ justify-content: center;
63
+ flex-wrap: wrap;
64
+ align-items: flex-start;
65
+ }
66
+
67
+ .image-container {
68
+ text-align: center;
69
+ flex: 1;
70
+ min-width: 300px;
71
+ }
72
+
73
+ .image-container img {
74
+ max-width: 100%;
75
+ height: auto;
76
+ border-radius: 10px;
77
+ border: 2px solid #198754;
78
+ }
79
+
80
+ .stats-summary {
81
+ background: #f8f9fa;
82
+ padding: 15px;
83
+ border-radius: 10px;
84
+ margin: 15px 0;
85
+ }
86
+ </style>
87
+ </head>
88
+ <body>
89
+ <div class="container mt-4">
90
+ <div class="result-card">
91
+ <h2 class="text-success fw-bold text-center">
92
+ 🎯 YOLO Detection Results
93
+ </h2>
94
+
95
+ {% if detection_count > 0 %}
96
+ <!-- Detection Summary -->
97
+ <div class="stats-summary text-center">
98
+ <h4 class="text-primary">📊 Detection Summary</h4>
99
+ <p class="mb-2">
100
+ <strong>Objects Found:</strong> {{ detection_count }}
101
+ </p>
102
+ <p class="mb-0"><strong>Confidence Threshold:</strong> 50%</p>
103
+ </div>
104
+
105
+ <!-- Image Comparison -->
106
+ <div class="image-comparison">
107
+ <div class="image-container">
108
+ <h5 class="text-muted">📤 Original Image</h5>
109
+ <img
110
+ src="{{ url_for('static', filename='uploads/' + original_image) }}"
111
+ alt="Original"
112
+ />
113
+ </div>
114
+ <div class="image-container">
115
+ <h5 class="text-success">🎯 With Detections</h5>
116
+ <img
117
+ src="{{ url_for('static', filename='uploads/' + detected_image) }}"
118
+ alt="With Detections"
119
+ />
120
+ </div>
121
+ </div>
122
+
123
+ <!-- Detection Details -->
124
+ <div class="mt-4">
125
+ <h5 class="text-center mb-3">🏷️ Detected Objects</h5>
126
+ <div class="text-center">
127
+ {% for detection in detections %} {% set confidence_class =
128
+ 'confidence-high' if detection.confidence >= 0.8 else
129
+ 'confidence-medium' if detection.confidence >= 0.6 else
130
+ 'confidence-low' %}
131
+ <span class="detection-badge {{ confidence_class }}">
132
+ <strong>{{ detection.class }}</strong> - {{
133
+ "%.1f"|format(detection.confidence * 100) }}%
134
+ </span>
135
+ {% endfor %}
136
+ </div>
137
+ </div>
138
+
139
+ <!-- Recycling Guidance -->
140
+ <div class="mt-4">
141
+ <h5 class="text-center mb-3">♻️ Recycling Guidance</h5>
142
+ {% for detection in detections %} {% if detection.class in ['plastic',
143
+ 'metal', 'glass', 'paper', 'cardboard'] %}
144
+ <div class="alert alert-success">
145
+ <strong>{{ detection.class.title() }}:</strong> ♻️ Recyclable -
146
+ Place in recycling bin
147
+ </div>
148
+ {% elif detection.class in ['organic', 'food', 'biological'] %}
149
+ <div class="alert alert-warning">
150
+ <strong>{{ detection.class.title() }}:</strong> 🌱 Compostable -
151
+ Place in organic waste bin
152
+ </div>
153
+ {% else %}
154
+ <div class="alert alert-danger">
155
+ <strong>{{ detection.class.title() }}:</strong> 🗑️ General waste -
156
+ Place in trash bin
157
+ </div>
158
+ {% endif %} {% endfor %}
159
+ </div>
160
+
161
+ {% else %}
162
+ <!-- No Detections -->
163
+ <div class="text-center mt-4">
164
+ <img
165
+ src="{{ url_for('static', filename='uploads/' + original_image) }}"
166
+ class="result-image"
167
+ />
168
+ <div class="alert alert-info mt-3">
169
+ <h5>🔍 No Objects Detected</h5>
170
+ {% if message %}
171
+ <p>{{ message }}</p>
172
+ {% else %}
173
+ <p>
174
+ No waste objects were detected with sufficient confidence (≥50%).
175
+ Try with a clearer image or different angle.
176
+ </p>
177
+ {% endif %}
178
+ </div>
179
+ </div>
180
+ {% endif %}
181
+
182
+ <!-- Action Buttons -->
183
+ <div class="text-center mt-4">
184
+ <a href="/" class="btn btn-success me-2">🔄 Process Another Image</a>
185
+ <a href="/stats" class="btn btn-info">📊 View Statistics</a>
186
+ </div>
187
+
188
+ <!-- Color Legend -->
189
+ <div class="mt-4 text-center">
190
+ <small class="text-muted">
191
+ <strong>Confidence Colors:</strong>
192
+ <span class="detection-badge confidence-high">High ≥80%</span>
193
+ <span class="detection-badge confidence-medium">Medium ≥60%</span>
194
+ <span class="detection-badge confidence-low">Low ≥50%</span>
195
+ </small>
196
+ </div>
197
+ </div>
198
+ </div>
199
+ </body>
200
+ </html>