49. YOLO Concept
“We reframe the object detection as a single regression problem, straight
from image pixels to bounding box coordinates and class probabilities.”
60. What is a frame
A video is a sequence of images
called frames. Each frame is a two-
dimensional grid of pixels. A set of
connected pixels is called a "blob."
In this case, the blob is a gull
fl
ying
across the camera's FOV from left to
right.
63. Pseudo Code (aka. algorithm)
• Step1: Objects are detected using a bounding box for the frame at time t-1
• Step 2: Calculate the centroids for the object detected for the frame at time t-1.
• Step 3: Objects are detected using a bounding box for the frame at time t. Assign a unique ID to the objects
• Step 4: Calculate the centroids of the object detected for the frame at time t.
• Step 5: Calculate the Euclidean distance between the centroids of all the objects detected in frames t-1 and t.
• Step 6: If the distance between the centroid at time t-1 and t is less than the threshold, it is the same object in
motion. Hence, use the existing object Id and update the bounding box coordinates of the object to the new
bounding box value.
• Step 7: If the distance between the centroid at time t-1 and t exceeds the threshold, add a new object id.
• Step 8:When objects detected in the previous frame cannot be matched to any existing objects, remove the
object id from tracking.
80. • What makes this tricky is that there are several di
ff
erent coordinate
systems that we’re dealing with:
• the full image, before resizing and cropping, e.g. 1920×1080 pixels
• the input image that the Core ML model sees, e.g. 416×416 pixels
• normalized coordinates relative to the crop region
• normalized coordinates relative to the full input image
• the UI view that displays the image and the bounding boxes
• Whenever we’re talking about bounding box coordinates, it’s important
to understand the reference frame in which these coordinates live.
Run YOLOv7 model on iOS devices
87. Camera in OpenCV is easy?
https://gitlab.com/nilvana-ai/toolbox/hikrobot-py/-/blob/main/hikcam.py
https://gitlab.com/nilvana-ai/nilvana-x-counting/frame-processor/-/blob/main/pkg/capturer/capturer.go#L50
1. enum device
2. select device and create handle
3. open device
4. set trigger mode
5. more settings [optional]
6. start grabbing
7. thread or software trigger
8. stop grabbing
9. close device
10. destroy handle