Gating
BlurGate
Source code in video_sampler/gating.py
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 |
|
__init__(method='laplacian', threshold=100)
Initializes the Gating object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
method |
str
|
The method to use for blur detection. Can be "fft" or "laplacian". |
'laplacian'
|
threshold |
float
|
The threshold for bluriness. The higher the threshold, the less blurry the image needs to be to be discarded. The default threshold values are: - 20 for the "fft" method - 100 for the "laplacian" method. |
100
|
Raises:
Type | Description |
---|---|
ValueError
|
If an unknown blur method is provided. |
Source code in video_sampler/gating.py
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 |
|
ClipGate
Source code in video_sampler/gating.py
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 193 194 195 196 197 198 199 200 |
|
__init__(pos_samples=None, neg_samples=None, model_name='ViT-B-32', batch_size=32, pos_margin=0.2, neg_margin=0.3)
Initializes the Clip Gating object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pos_samples |
list[str]
|
List of positive samples. Defaults to None. |
None
|
neg_samples |
list[str]
|
List of negative samples. Defaults to None. |
None
|
model_name |
str
|
Name of the model. Defaults to "ViT-B-32". |
'ViT-B-32'
|
batch_size |
int
|
Batch size. Defaults to 32. |
32
|
pos_margin |
float
|
Positive margin. Defaults to 0.2. |
0.2
|
neg_margin |
float
|
Negative margin. Defaults to 0.3. |
0.3
|
Source code in video_sampler/gating.py
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 |
|
PassGate
Source code in video_sampler/gating.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
|
__call__(frame, meta, last=False)
Passes the frame through the gating mechanism.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
frame |
Image
|
The frame to pass through. |
required |
meta |
dict
|
The metadata for the frame. |
required |
last |
bool
|
If this is the last frame in the video. |
False
|
Returns:
Name | Type | Description |
---|---|---|
GatedObject |
GatedObject
|
The gated object containing the processed frame. |
Source code in video_sampler/gating.py
36 37 38 39 40 41 42 43 44 45 46 47 48 |
|
create_gate(gate_config)
Create a gate from a configuration.
Source code in video_sampler/gating.py
203 204 205 206 207 208 209 210 211 212 213 214 |
|