visibility
sleap.qc.features.visibility
¶
Visibility pattern features.
Classes:
| Name | Description |
|---|---|
VisibilityModel |
Learn and score visibility patterns. |
Functions:
| Name | Description |
|---|---|
compute_isolated_invisible |
Detect invisible nodes with all visible neighbors. |
VisibilityModel
¶
Learn and score visibility patterns.
Learns which nodes tend to be visible together, then flags instances where the visibility pattern is unusual (e.g., hip visible but knee invisible when they're usually both visible or both invisible).
Attributes:
| Name | Type | Description |
|---|---|---|
n_nodes |
int
|
Number of nodes in skeleton. |
co_visibility_matrix |
Optional[ndarray]
|
P(node_j visible | node_i visible). |
visibility_rates |
Optional[ndarray]
|
Per-node visibility rates. |
n_instances |
int
|
Number of instances used for fitting. |
Methods:
| Name | Description |
|---|---|
__init__ |
Initialize the visibility model. |
fit |
Learn co-visibility patterns from data. |
get_expected_visibility |
Given some visible nodes, predict expected visibility of others. |
score |
Score how unusual a visibility pattern is. |
Source code in sleap/qc/features/visibility.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | |
__init__()
¶
Initialize the visibility model.
fit(visibility_masks)
¶
Learn co-visibility patterns from data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
visibility_masks
|
ndarray
|
(N_instances, N_nodes) boolean array. True = visible, False = invisible. |
required |
Returns:
| Type | Description |
|---|---|
'VisibilityModel'
|
Self for chaining. |
Source code in sleap/qc/features/visibility.py
get_expected_visibility(partial_mask)
¶
Given some visible nodes, predict expected visibility of others.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
partial_mask
|
ndarray
|
(N_nodes,) boolean array with some nodes marked visible. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
(N_nodes,) array of expected visibility probabilities. |
Source code in sleap/qc/features/visibility.py
score(visibility_mask)
¶
Score how unusual a visibility pattern is.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
visibility_mask
|
ndarray
|
(N_nodes,) boolean array. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, float]
|
Dictionary with: - pattern_score: overall unusualness (0 = normal, 1 = very unusual) - n_violations: count of strong violations |
Source code in sleap/qc/features/visibility.py
compute_isolated_invisible(visibility_mask, edges)
¶
Detect invisible nodes with all visible neighbors.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
visibility_mask
|
ndarray
|
(N_nodes,) boolean array. |
required |
edges
|
list[tuple[int, int]]
|
List of (src, dst) node index pairs. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, float]
|
Dictionary with: - has_isolated_invisible: bool - isolated_invisible_nodes: list of node indices - n_isolated_invisible: count |