Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/skalskip/sketchy-vision
Each week I create sketches covering key Computer Vision concepts. If you want to learn more about CV stick around!
https://github.com/skalskip/sketchy-vision
computer-vision convolutional-neural-networks deep-learning neural-network non-maximum-suppression numpy object-detection
Last synced: 2 months ago
JSON representation
Each week I create sketches covering key Computer Vision concepts. If you want to learn more about CV stick around!
- Host: GitHub
- URL: https://github.com/skalskip/sketchy-vision
- Owner: SkalskiP
- Created: 2023-03-09T11:51:34.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2023-03-13T10:17:57.000Z (almost 2 years ago)
- Last Synced: 2024-10-10T12:42:12.440Z (3 months ago)
- Topics: computer-vision, convolutional-neural-networks, deep-learning, neural-network, non-maximum-suppression, numpy, object-detection
- Homepage:
- Size: 4.88 KB
- Stars: 146
- Watchers: 16
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
sketchy vision
## 👋 hello
Each week I create sketches covering key Computer Vision concepts. If you want to learn more about CV stick around!
![title](https://i.imgur.com/gbhmVy9.png)
👆 click to read code snippet
```python
def box_iou_batch(boxes_a: np.ndarray, boxes_b: np.ndarray) -> np.ndarray:def box_area(box):
return (box[2] - box[0]) * (box[3] - box[1])area_a = box_area(boxes_a.T)
area_b = box_area(boxes_b.T)top_left = np.maximum(boxes_a[:, None, :2], boxes_b[:, :2])
bottom_right = np.minimum(boxes_a[:, None, 2:], boxes_b[:, 2:])area_inter = np.prod(np.clip(bottom_right - top_left, a_min=0, a_max=None), 2)
return area_inter / (area_a[:, None] + area_b - area_inter)
```![title](https://i.imgur.com/o4CELyL.jpg)
👆 click to read code snippet
```python
def non_max_suppression(predictions: np.ndarray, iou_threshold: float = 0.5) -> np.ndarray:
rows, columns = predictions.shapesort_index = np.flip(predictions[:, 4].argsort())
predictions = predictions[sort_index]boxes = predictions[:, :4]
categories = predictions[:, 5]
ious = box_iou_batch(boxes, boxes)
ious = ious - np.eye(rows)keep = np.ones(rows, dtype=bool)
for index, (iou, category) in enumerate(zip(ious, categories)):
if not keep[index]:
continuecondition = (iou > iou_threshold) & (categories == category)
keep = keep & ~conditionreturn keep[sort_index.argsort()]
```![title](https://i.imgur.com/Ixiv5do.png)