Real-time Fake Detection
Kano provides classes for simulating and visualizing object detection results, including smooth transitions between bounding boxes. The following classes are included:
FakeDetect
: Simulates smooth transitions between two bounding boxes over a specified duration, ideal for testing object detection systems.DetectGen
: Manages and generates a sequence of fake detections with looping options like NoLoop, Reversed, and Replay for flexible simulation and testing.
kano.lab.box_gen.fake_detect.FakeDetect
Simulates an animated transition between two boxes over a specified duration.
Source code in kano\lab\box_gen\fake_detect.py
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 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 |
|
__init__(begin_box, end_box, duration, start_after=0, from_bottom=False)
Initializes the FakeDetect instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
begin_box |
Box
|
The starting box of the transition. |
required |
end_box |
Box
|
The ending box of the transition. |
required |
duration |
float
|
The duration of the transition in seconds. |
required |
start_after |
float
|
The delay before starting the transition. Default is 0. |
0
|
from_bottom |
bool
|
Whether to use bottom-aligned coordinates. Default is False. |
False
|
Source code in kano\lab\box_gen\fake_detect.py
is_end(current_time)
Determines whether the transition has finished.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
current_time |
float
|
The current time to check against the transition's end time. |
required |
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if the transition has ended, False otherwise. |
Raises:
Type | Description |
---|---|
ValueError
|
If the start time is not set. |
Source code in kano\lab\box_gen\fake_detect.py
move(current_time)
Computes the current box's coordinates in (xmin, ymin, xmax, ymax) format.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
current_time |
float
|
The current time used to compute the box's state. |
required |
Returns:
Type | Description |
---|---|
ndarray
|
np.ndarray: The current box's coordinates, or None if the transition has not started or is finished. |
Raises:
Type | Description |
---|---|
ValueError
|
If the start time is not set. |
Source code in kano\lab\box_gen\fake_detect.py
reverse()
start(current_time)
Starts the transition at the specified current time.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
current_time |
float
|
The current time to start the transition. |
required |
kano.lab.box_gen.detect_gen.DetectGen
Class to manage and generate a sequence of fake detections for animation or simulation purposes.
Source code in kano\lab\box_gen\detect_gen.py
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 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 |
|
__init__(boxes, durations, start_after=0, from_bottom=False, loop_type=LoopType.NoLoop)
Initializes the DetectGen object with the given boxes and durations.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
boxes |
List[Box]
|
A list of Box objects representing the sequence. |
required |
durations |
List[float]
|
Durations for transitions between boxes. |
required |
start_after |
float
|
Initial delay before starting the sequence. Default is 0. |
0
|
from_bottom |
bool
|
Whether to use bottom-aligned coordinates. Default is False. |
False
|
loop_type |
LoopType
|
Type of looping for the sequence. Default is NoLoop. |
NoLoop
|
Raises:
Type | Description |
---|---|
InvalidEnumValueError
|
If the loop_type is not a valid LoopType. |
Source code in kano\lab\box_gen\detect_gen.py
gen_xyxy(current_time)
Generates the current (xmin, ymin, xmax, ymax) coordinates for the sequence.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
current_time |
float
|
The current time for coordinate generation. |
required |
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if the sequence has ended, otherwise False. |
Source code in kano\lab\box_gen\detect_gen.py
get_sequence_detect(boxes, durations, start_after=0, from_bottom=False)
Creates a sequence of FakeDetect objects based on the provided boxes and durations.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
boxes |
List[Box]
|
A list of Box objects representing the sequence. |
required |
durations |
List[float]
|
A list of durations for transitions between boxes. |
required |
start_after |
float
|
Initial delay before starting the sequence. Default is 0. |
0
|
from_bottom |
bool
|
Whether to use bottom-aligned coordinates. Default is False. |
False
|
Returns:
Type | Description |
---|---|
List[FakeDetect]
|
List[FakeDetect]: A list of FakeDetect objects for the sequence. |
Raises:
Type | Description |
---|---|
ValueError
|
If there are fewer than 2 boxes or if the number of durations is invalid. |
Source code in kano\lab\box_gen\detect_gen.py
replay_sequence()
Replays the detection sequence from the beginning.
Source code in kano\lab\box_gen\detect_gen.py
reverse_sequence()
Reverses the sequence of detections.
Source code in kano\lab\box_gen\detect_gen.py
start(current_time)
Starts the sequence at the specified current time.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
current_time |
float
|
The current time to start the sequence. |
required |