Merge pull request #1826 from roboflow/feature/make-supervision-annotators-compatible-with-trackers-pending-tracker-id

make `supervision` annotators compatible with `trackers` pending tracker ID
This commit is contained in:
Piotr Skalski
2025-04-23 15:52:05 +02:00
committed by GitHub
3 changed files with 20 additions and 10 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
name = "supervision"
description = "A set of easy-to-use utils that will come in handy in any Computer Vision project"
license = { text = "MIT" }
version = "0.26.0rc4"
version = "0.26.0rc5"
readme = "README.md"
requires-python = ">=3.8"
authors = [
+5
View File
@@ -7,6 +7,9 @@ from supervision.detection.core import Detections
from supervision.draw.color import Color, ColorPalette
from supervision.geometry.core import Position
PENDING_TRACK_COLOR = Color.GREY
PENDING_TRACK_ID = -1
class ColorLookup(Enum):
"""
@@ -136,6 +139,8 @@ def resolve_color(
detection_idx=detection_idx,
color_lookup=color_lookup,
)
if color_lookup == ColorLookup.TRACK and idx == PENDING_TRACK_ID:
return PENDING_TRACK_COLOR
return get_color_by_index(color=color, idx=idx)
+14 -9
View File
@@ -83,15 +83,16 @@ class Color:
# Color(r=255, g=255, b=255)
```
| Constant | Hex Code | RGB |
|------------|------------|------------------|
| `WHITE` | `#FFFFFF` | `(255, 255, 255)`|
| `BLACK` | `#000000` | `(0, 0, 0)` |
| `RED` | `#FF0000` | `(255, 0, 0)` |
| `GREEN` | `#00FF00` | `(0, 255, 0)` |
| `BLUE` | `#0000FF` | `(0, 0, 255)` |
| `YELLOW` | `#FFFF00` | `(255, 255, 0)` |
| `ROBOFLOW` | `#A351FB` | `(163, 81, 251)` |
| Constant | Hex Code | RGB |
|------------|------------|-------------------|
| `WHITE` | `#FFFFFF` | `(255, 255, 255)` |
| `BLACK` | `#000000` | `(0, 0, 0)` |
| `GREY` | `#808080` | `(128, 128, 128)` |
| `RED` | `#FF0000` | `(255, 0, 0)` |
| `GREEN` | `#00FF00` | `(0, 255, 0)` |
| `BLUE` | `#0000FF` | `(0, 0, 255)` |
| `YELLOW` | `#FFFF00` | `(255, 255, 0)` |
| `ROBOFLOW` | `#A351FB` | `(163, 81, 251)` |
"""
r: int
@@ -235,6 +236,10 @@ class Color:
def BLACK(cls) -> Color:
return Color.from_hex("#000000")
@classproperty
def GREY(cls) -> Color:
return Color.from_hex("#808080")
@classproperty
def RED(cls) -> Color:
return Color.from_hex("#FF0000")