Skip to content

Commit b38a6a7

Browse files
committed
checkin new tethers
1 parent 04be131 commit b38a6a7

16 files changed

+621
-0
lines changed

.tether/man/initializer_stft.txt

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
Help on class STFT in module keras.src.initializers.constant_initializers:
2+
3+
class STFT(keras.src.initializers.initializer.Initializer)
4+
| STFT(side='real', window='hann', scaling='density', periodic=False)
5+
|
6+
| Initializer of Conv kernels for Short-term Fourier Transformation (STFT).
7+
|
8+
| Since the formula involves complex numbers, this class compute either the
9+
| real or the imaginary components of the final output.
10+
|
11+
| Additionally, this initializer supports windowing functions across the time
12+
| dimension as commonly used in STFT. Windowing functions from the module
13+
| `scipy.signal.windows` are supported, including the common `hann` and
14+
| `hamming` windowing functions. This layer supports periodic windows and
15+
| scaling-based normalization.
16+
|
17+
| This is primarily intended for use in the `STFTSpectrogram` layer.
18+
|
19+
| Examples:
20+
|
21+
| >>> # Standalone usage:
22+
| >>> initializer = STFTInitializer("real", "hann", "density", False)
23+
| >>> values = initializer(shape=(128, 1, 513))
24+
|
25+
| Args:
26+
| side: String, `"real"` or `"imag"` deciding if the kernel will compute
27+
| the real side or the imaginary side of the output. Defaults to
28+
| `"real"`.
29+
| window: String for the name of the windowing function in the
30+
| `scipy.signal.windows` module, or array_like for the window values,
31+
| or `None` for no windowing.
32+
| scaling: String, `"density"` or `"spectrum"` for scaling of the window
33+
| for normalization, either L2 or L1 normalization.
34+
| `None` for no scaling.
35+
| periodic: Boolean, if True, the window function will be treated as
36+
| periodic. Defaults to `False`.
37+
|
38+
| Method resolution order:
39+
| STFT
40+
| keras.src.initializers.initializer.Initializer
41+
| builtins.object
42+
|
43+
| Methods defined here:
44+
|
45+
| __call__(
46+
| self,
47+
| shape,
48+
| dtype=None
49+
| )
50+
| Returns a tensor object initialized as specified by the initializer.
51+
|
52+
| The shape is assumed to be `(T, 1, F // 2 + 1)`, where `T` is the size
53+
| of the given window, and `F` is the number of frequency bands. Only half
54+
| the frequency bands are used, which is a common practice in STFT,
55+
| because the second half are the conjugates of the first half in
56+
| a reversed order.
57+
|
58+
| Args:
59+
| shape: Shape of the tensor.
60+
| dtype: Optional dtype of the tensor. Only numeric or boolean dtypes
61+
| are supported. If not specified, `keras.backend.floatx()`
62+
| is used, which default to `float32` unless you configured it
63+
| otherwise (via `keras.backend.set_floatx(float_dtype)`).
64+
|
65+
| __init__(
66+
| self,
67+
| side='real',
68+
| window='hann',
69+
| scaling='density',
70+
| periodic=False
71+
| )
72+
| Initialize self. See help(type(self)) for accurate signature.
73+
|
74+
| get_config(self)
75+
| Returns the initializer's configuration as a JSON-serializable dict.
76+
|
77+
| Returns:
78+
| A JSON-serializable Python dict.
79+
|
80+
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
affine_transform(
2+
boxes,
3+
angle,
4+
translate_x,
5+
translate_y,
6+
scale,
7+
shear_x,
8+
shear_y,
9+
height,
10+
width,
11+
center_x=None,
12+
center_y=None,
13+
format='xyxy'
14+
)
15+
clip_to_image_size(
16+
bounding_boxes,
17+
height=None,
18+
width=None,
19+
format='xyxy'
20+
)
21+
convert_format(
22+
boxes,
23+
source,
24+
target,
25+
height=None,
26+
width=None,
27+
dtype='float32'
28+
)
29+
crop(
30+
boxes,
31+
top,
32+
left,
33+
height,
34+
width,
35+
format='xyxy'
36+
)
37+
pad(
38+
boxes,
39+
top,
40+
left,
41+
format='xyxy'
42+
)
43+
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
draw_bounding_boxes(
2+
images,
3+
bounding_boxes,
4+
bounding_box_format,
5+
class_mapping=None,
6+
color=(128, 128, 128),
7+
line_thickness=2,
8+
text_thickness=1,
9+
font_scale=1.0,
10+
data_format=None
11+
)
12+
draw_segmentation_masks(
13+
images,
14+
segmentation_masks,
15+
num_classes=None,
16+
color_mapping=None,
17+
alpha=0.8,
18+
blend=True,
19+
ignore_index=-1,
20+
data_format=None
21+
)
22+
plot_bounding_box_gallery(
23+
images,
24+
bounding_box_format,
25+
y_true=None,
26+
y_pred=None,
27+
value_range=(0, 255),
28+
true_color=(0, 188, 212),
29+
pred_color=(255, 235, 59),
30+
line_thickness=2,
31+
font_scale=1.0,
32+
text_thickness=None,
33+
class_mapping=None,
34+
ground_truth_mapping=None,
35+
prediction_mapping=None,
36+
legend=False,
37+
legend_handles=None,
38+
rows=None,
39+
cols=None,
40+
data_format=None,
41+
**kwargs
42+
)
43+
plot_image_gallery(
44+
images,
45+
rows=None,
46+
cols=None,
47+
value_range=(0, 255),
48+
scale=2,
49+
path=None,
50+
show=None,
51+
transparent=True,
52+
dpi=60,
53+
legend_handles=None,
54+
data_format=None
55+
)
56+
plot_segmentation_mask_gallery(
57+
images,
58+
num_classes,
59+
value_range=(0, 255),
60+
y_true=None,
61+
y_pred=None,
62+
color_mapping=None,
63+
blend=True,
64+
alpha=0.8,
65+
ignore_index=-1,
66+
data_format=None,
67+
**kwargs
68+
)
69+

.tether/man/loss_circle.txt

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
Help on class Circle in module keras.src.losses.losses:
2+
3+
class Circle(LossFunctionWrapper)
4+
| Circle(gamma=80.0, margin=0.4, remove_diagonal=True, reduction='sum_over_batch_size', name='circle', dtype=None)
5+
|
6+
| Computes Circle Loss between integer labels and L2-normalized embeddings.
7+
|
8+
| This is a metric learning loss designed to minimize within-class distance
9+
| and maximize between-class distance in a flexible manner by dynamically
10+
| adjusting the penalty strength based on optimization status of each
11+
| similarity score.
12+
|
13+
| To use Circle Loss effectively, the model should output embeddings without
14+
| an activation function (such as a `Dense` layer with `activation=None`)
15+
| followed by UnitNormalization layer to ensure unit-norm embeddings.
16+
|
17+
| Args:
18+
| gamma: Scaling factor that determines the largest scale of each
19+
| similarity score. Defaults to `80`.
20+
| margin: The relaxation factor, below this distance, negatives are
21+
| up weighted and positives are down weighted. Similarly, above this
22+
| distance negatives are down weighted and positive are up weighted.
23+
| Defaults to `0.4`.
24+
| remove_diagonal: Boolean, whether to remove self-similarities from the
25+
| positive mask. Defaults to `True`.
26+
| reduction: Type of reduction to apply to the loss. In almost all cases
27+
| this should be `"sum_over_batch_size"`. Supported options are
28+
| `"sum"`, `"sum_over_batch_size"`, `"mean"`,
29+
| `"mean_with_sample_weight"` or `None`. `"sum"` sums the loss,
30+
| `"sum_over_batch_size"` and `"mean"` sum the loss and divide by the
31+
| sample size, and `"mean_with_sample_weight"` sums the loss and
32+
| divides by the sum of the sample weights. `"none"` and `None`
33+
| perform no aggregation. Defaults to `"sum_over_batch_size"`.
34+
| name: Optional name for the loss instance.
35+
| dtype: The dtype of the loss's computations. Defaults to `None`, which
36+
| means using `keras.backend.floatx()`. `keras.backend.floatx()` is a
37+
| `"float32"` unless set to different value
38+
| (via `keras.backend.set_floatx()`). If a `keras.DTypePolicy` is
39+
| provided, then the `compute_dtype` will be utilized.
40+
|
41+
| Examples:
42+
|
43+
| Usage with the `compile()` API:
44+
|
45+
| ```python
46+
| model = models.Sequential([
47+
| keras.layers.Input(shape=(224, 224, 3)),
48+
| keras.layers.Conv2D(16, (3, 3), activation='relu'),
49+
| keras.layers.Flatten(),
50+
| keras.layers.Dense(64, activation=None), # No activation
51+
| keras.layers.UnitNormalization() # L2 normalization
52+
| ])
53+
|
54+
| model.compile(optimizer="adam", loss=keras.losses.Circle())
55+
| ```
56+
|
57+
| Reference:
58+
| - [Yifan Sun et al., 2020](https://arxiv.org/abs/2002.10857)
59+
|
60+
| Method resolution order:
61+
| Circle
62+
| LossFunctionWrapper
63+
| keras.src.losses.loss.Loss
64+
| keras.src.saving.keras_saveable.KerasSaveable
65+
| builtins.object
66+
|
67+
| Methods defined here:
68+
|
69+
| __init__(
70+
| self,
71+
| gamma=80.0,
72+
| margin=0.4,
73+
| remove_diagonal=True,
74+
| reduction='sum_over_batch_size',
75+
| name='circle',
76+
| dtype=None
77+
| )
78+
| Initialize self. See help(type(self)) for accurate signature.
79+
|
80+
| get_config(self)
81+
|
82+
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
Help on class ConcordanceCorrelation in module keras.src.metrics.correlation_metrics:
2+
3+
class ConcordanceCorrelation(keras.src.metrics.reduction_metrics.MeanMetricWrapper)
4+
| ConcordanceCorrelation(name='concordance_correlation', dtype=None, axis=-1)
5+
|
6+
| Calculates the Concordance Correlation Coefficient (CCC).
7+
|
8+
| CCC evaluates the agreement between true values (`y_true`) and predicted
9+
| values (`y_pred`) by considering both precision and accuracy. The
10+
| coefficient ranges from -1 to 1, where a value of 1 indicates perfect
11+
| agreement.
12+
|
13+
| This metric is useful in regression tasks where it is important to assess
14+
| how well the predictions match the true values, taking into account both
15+
| their correlation and proximity to the 45-degree line of perfect
16+
| concordance.
17+
|
18+
| Args:
19+
| name: (Optional) string name of the metric instance.
20+
| dtype: (Optional) data type of the metric result.
21+
| axis: (Optional) integer or tuple of integers of the axis/axes along
22+
| which to compute the metric. Defaults to `-1`.
23+
|
24+
| Example:
25+
|
26+
| >>> ccc = keras.metrics.ConcordanceCorrelation(axis=-1)
27+
| >>> y_true = [[0, 1, 0.5], [1, 1, 0.2]]
28+
| >>> y_pred = [[0.1, 0.9, 0.5], [1, 0.9, 0.2]]
29+
| >>> ccc.update_state(y_true, y_pred)
30+
| >>> ccc.result()
31+
| 0.9816320385426076
32+
|
33+
| Usage with `compile()` API:
34+
|
35+
| ```python
36+
| model.compile(optimizer='sgd',
37+
| loss='mean_squared_error',
38+
| metrics=[keras.metrics.ConcordanceCorrelation()])
39+
| ```
40+
|
41+
| Method resolution order:
42+
| ConcordanceCorrelation
43+
| keras.src.metrics.reduction_metrics.MeanMetricWrapper
44+
| keras.src.metrics.reduction_metrics.Mean
45+
| keras.src.metrics.metric.Metric
46+
| keras.src.saving.keras_saveable.KerasSaveable
47+
| builtins.object
48+
|
49+
| Methods defined here:
50+
|
51+
| __init__(
52+
| self,
53+
| name='concordance_correlation',
54+
| dtype=None,
55+
| axis=-1
56+
| )
57+
| Initialize self. See help(type(self)) for accurate signature.
58+
|
59+
| get_config(self)
60+
| Return the serializable config of the metric.
61+
|
62+

0 commit comments

Comments
 (0)