imgtools.statistics
Statistics functions
Links
Basic
Calculate the mean, standard deviation (std), and dataset size of the combination of two datasets. |
|
Compute the histogram of an image. |
Documents
- imgtools.statistics.combine_mean_std(*stats: tuple[Tensor, Tensor, int]) tuple[Tensor, Tensor, int]
Calculate the mean, standard deviation (std), and dataset size of the combination of two datasets. The
The function is present for evaluating the mean and std of a large dataset by computing its sub-datasets. To see the inference of the formula, check [1].
This function is not jit-able.
- Parameters:
- statstuple[torch.Tensor, torch.Tensor, int]
The [mean, standard deviation, number of samples] of dataset(s). np.ndarray type is also acceptable.
- Returns:
- torch.tensor
The mean value of the combined dataset.
- torch.tensor
The standard deviation of the combined dataset.
- int
The number of samples of the combined dataset.
References
- [1] stack exchange - How do I combine standard deviations of two groups?
https://math.stackexchange.com/questions/2971315/how-do-i-combine-standard-deviations-of-two-groups
- imgtools.statistics.histogram(img: Tensor, bins: int = 256, density: bool = False) Tensor
Compute the histogram of an image.
- Parameters:
- imgtorch.Tensor
An image in the range of [0, 1] with 2 <= img.ndim <= 4.
- binsint, default=256
The number of groups in data range.
- densitybool, default=False
If true, return the pdf of each channel.
- Returns:
- torch.Tensor
The histogram or density.
- Raises:
- TypeError
If bins is not int type.