Skip to content

Commit f4b38ee

Browse files
committed
fixed issues with png images
1 parent 3579fe4 commit f4b38ee

File tree

1 file changed

+46
-40
lines changed

1 file changed

+46
-40
lines changed

_posts/2025-04-27-insect-detection.md

Lines changed: 46 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,12 @@ When a camera sits still, most of the scene stays the same. If a handful of pixe
8585
</ol>
8686

8787
<div class="col-sm mt-3 mt-md-0 text-center">
88-
<img src="/assets/blogs/insect_detection/motion_detection/motion_detection_mask.png"
88+
<div style="background: white; padding: 10px; display: inline-block; border-radius: 8px;">
89+
<img src="/assets/blogs/insect_detection/motion_detection/motion_detection_mask.png"
8990
class="img-fluid rounded"
9091
style="margin-bottom: 20px;"
9192
alt="Motion Detection Mask">
93+
</div>
9294
</div>
9395
<div class="caption mt-2 text-center">
9496
Fig. 3: Difference mask obtained by subtracting the current frame from the background and then thresholding.
@@ -107,65 +109,67 @@ Motion detection is all around us. Here are a few real-world examples:
107109

108110
## Insect detection with YOLO
109111

110-
Motion detection points out _where_ to look, and **YOLO** tells us _what_ is moving. YOLO is an object detection model that draws boxes around objects and labels them. We use YOLO for insects because:
112+
Motion detection points out _where_ to look, and **YOLO** tells us _what_ is moving. YOLO<d-cite key="redmon2016you"></d-cite> is an object detection model that draws boxes around objects and labels them. We use YOLO for insects because:
111113

112114
* **Real-time:** Runs at video speed, even on small devices.
113115
* **All-in-one:** Finds both location and the insect’s identity in a single pass.
114116
* **Open-source:** Free models (YOLOv8) and easy training tools are available.
115117

118+
We now describe the original version of YOLO. Although many improvements have been made across subsequent versions, the core ideas outlined below remain the same.
119+
116120
### The quick YOLO tour
117121

118122
<ol>
119123
<li>
120124
<strong>Candidate frames</strong><br>
121125
<em>After motion detection, we extract snapshots that might contain insects.</em>
122-
<figure class="text-center">
126+
<div class="text-center">
123127
<img src="/assets/blogs/insect_detection/yolo_steps/input_image.jpg"
124-
alt="Input Image"
125-
class="img-fluid rounded">
126-
<figcaption class="mt-2" style="font-size: 0.9rem; color: #555;">
127-
Fig. 4: Input image for insect detection, obtained from motion detection.
128-
</figcaption>
129-
</figure>
128+
alt="Input Image"
129+
class="img-fluid rounded">
130+
<div class="caption mt-2 text-center">
131+
Fig. 4: Input image for insect detection, obtained from motion detection.
132+
</div>
133+
</div>
130134
</li>
131135

132136
<li>
133137
<strong>Resize & grid</strong><br>
134138
<em>Resize each snapshot to 448×448 pixels and overlay a 7×7 grid.</em>
135-
<figure class="text-center">
139+
<div class="text-center">
136140
<img src="/assets/blogs/insect_detection/yolo_steps/cropped_grid_image.png"
137-
alt="Cropped and 7x7 grid overlayed image"
138-
class="img-fluid rounded">
139-
<figcaption class="mt-2" style="font-size: 0.9rem; color: #555;">
140-
Fig. 5: A 7×7 grid overlaid on the cropped image.
141-
</figcaption>
142-
</figure>
141+
alt="Cropped and 7x7 grid overlayed image"
142+
class="img-fluid rounded">
143+
<div class="caption mt-2 text-center">
144+
Fig. 5: A 7×7 grid overlaid on the cropped image.
145+
</div>
146+
</div>
143147
</li>
144148

145149
<li>
146150
<strong>One glance, many predictions</strong><br>
147151
<em>For each grid cell, YOLO’s neural network predicts several bounding boxes, confidence scores, and class probabilities for different insects.</em>
148-
<figure class="text-center">
152+
<div class="text-center">
149153
<img src="/assets/blogs/insect_detection/yolo_steps/grid_cell_prediction.png"
150-
alt="YOLO grid cell predictions"
151-
class="img-fluid rounded">
152-
<figcaption class="mt-2" style="font-size: 0.9rem; color: #555;">
153-
Fig. 6: The green box has a high confidence score and class probability; the red boxes are low confidence.
154-
</figcaption>
155-
</figure>
154+
alt="YOLO grid cell predictions"
155+
class="img-fluid rounded">
156+
<div class="caption mt-2 text-center">
157+
Fig. 6: The green box has a high confidence score and class probability; the red boxes are low confidence.
158+
</div>
159+
</div>
156160
</li>
157161

158162
<li>
159163
<strong>Keep the best</strong><br>
160164
<em>Non-Maximum Suppression (NMS)<d-cite key="hosang2017learning"></d-cite> keeps the highest-scoring box and removes overlapping, lower-scoring ones.</em>
161-
<figure class="text-center">
165+
<div class="text-center">
162166
<img src="/assets/blogs/insect_detection/yolo_steps/non_maximum_suppression.png"
163167
alt="Non Maximum Suppression process"
164168
class="img-fluid rounded">
165-
<figcaption class="mt-2" style="font-size: 0.9rem; color: #555;">
166-
Fig. 7: NMS removes duplicate boxes, leaving one clear box per object.
167-
</figcaption>
168-
</figure>
169+
<div class="caption mt-2 text-center">
170+
Fig. 7: NMS removes duplicate boxes, leaving one clear box per object.
171+
</div>
172+
</div>
169173
<p class="mt-2">
170174
After predicting many boxes, NMS:
171175
</p>
@@ -189,14 +193,16 @@ Motion detection points out _where_ to look, and **YOLO** tells us _what_ is mov
189193
<ol>
190194
<li>
191195
<strong>How are the bounding boxes represented?</strong>
192-
<figure class="text-center">
193-
<img src="/assets/blogs/insect_detection/yolo_steps/bounding_box_representation.png"
194-
alt="Bounding box representation"
195-
class="img-fluid rounded">
196-
<figcaption class="mt-2" style="font-size: 0.9rem; color: #555;">
196+
<div class="text-center">
197+
<div style="background: white; padding: 10px; display: inline-block; border-radius: 8px;">
198+
<img src="/assets/blogs/insect_detection/yolo_steps/bounding_box_representation.png"
199+
alt="Bounding box representation"
200+
class="img-fluid rounded">
201+
</div>
202+
<div class="caption mt-2 text-center">
197203
Fig. 8: Bounding box representation.
198-
</figcaption>
199-
</figure>
204+
</div>
205+
</div>
200206
<ul style="margin-top: 0.5rem; margin-bottom: 0;">
201207
<li>Each box is defined by (cx, cy, w, h).</li>
202208
<li>(cx, cy) is the box center, normalized within its grid cell.</li>
@@ -206,14 +212,14 @@ Motion detection points out _where_ to look, and **YOLO** tells us _what_ is mov
206212

207213
<li>
208214
<strong>What if the insect overlaps two grid cells?</strong>
209-
<figure class="text-center">
215+
<div class="text-center">
210216
<img src="/assets/blogs/insect_detection/yolo_steps/overlapping_grid_cells.png"
211217
alt="Overlapping grid cells"
212218
class="img-fluid rounded">
213-
<figcaption class="mt-2" style="font-size: 0.9rem; color: #555;">
214-
Fig. 9: Handling overlapping grid cells.
215-
</figcaption>
216-
</figure>
219+
<div class="caption mt-2 text-center">
220+
Fig. 9: Handling overlapping grid cells.
221+
</div>
222+
</div>
217223
<ul style="margin-top: 10px;">
218224
<li>Only the cell (marked as 1) containing the insect’s center (marked by a star) makes the prediction.</li>
219225
<li>Neighboring cells ignore this insect and focus on objects whose centers lie inside them.</li>

0 commit comments

Comments
 (0)