|
Safemotion Lib
|
Public Member Functions | |
| __init__ (self, start_iter=0) | |
| put_image (self, img_name, img_tensor) | |
| put_scalar (self, name, value, smoothing_hint=True) | |
| put_scalars (self, *smoothing_hint=True, **kwargs) | |
| put_histogram (self, hist_name, hist_tensor, bins=1000) | |
| history (self, name) | |
| histories (self) | |
| latest (self) | |
| latest_with_smoothing_hint (self, window_size=20) | |
| smoothing_hints (self) | |
| step (self) | |
| iter (self) | |
| iteration (self) | |
| __enter__ (self) | |
| __exit__ (self, exc_type, exc_val, exc_tb) | |
| name_scope (self, name) | |
| clear_images (self) | |
| clear_histograms (self) | |
Protected Attributes | |
| _history | |
| _smoothing_hints | |
| _latest_scalars | |
| _iter | |
| _current_prefix | |
| _vis_data | |
| _histograms | |
The user-facing class that provides metric storage functionalities. In the future we may add support for storing / logging other types of data if needed.
| fastreid.utils.events.EventStorage.__init__ | ( | self, | |
| start_iter = 0 ) |
Args:
start_iter (int): the iteration number to start with
Definition at line 256 of file events.py.
| fastreid.utils.events.EventStorage.__enter__ | ( | self | ) |
| fastreid.utils.events.EventStorage.__exit__ | ( | self, | |
| exc_type, | |||
| exc_val, | |||
| exc_tb ) |
| fastreid.utils.events.EventStorage.clear_histograms | ( | self | ) |
Delete all the stored histograms for visualization. This should be called after histograms are written to tensorboard.
Definition at line 440 of file events.py.
| fastreid.utils.events.EventStorage.clear_images | ( | self | ) |
Delete all the stored images for visualization. This should be called after images are written to tensorboard.
Definition at line 433 of file events.py.
| fastreid.utils.events.EventStorage.histories | ( | self | ) |
| fastreid.utils.events.EventStorage.history | ( | self, | |
| name ) |
Returns:
HistoryBuffer: the scalar history for name
Definition at line 346 of file events.py.
| fastreid.utils.events.EventStorage.iter | ( | self | ) |
| fastreid.utils.events.EventStorage.iteration | ( | self | ) |
| fastreid.utils.events.EventStorage.latest | ( | self | ) |
Returns:
dict[str -> (float, int)]: mapping from the name of each scalar to the most
recent value and the iteration number its added.
Definition at line 363 of file events.py.
| fastreid.utils.events.EventStorage.latest_with_smoothing_hint | ( | self, | |
| window_size = 20 ) |
Similar to :meth:`latest`, but the returned values are either the un-smoothed original latest value, or a median of the given window_size, depend on whether the smoothing_hint is True. This provides a default behavior that other writers can use.
Definition at line 371 of file events.py.
| fastreid.utils.events.EventStorage.name_scope | ( | self, | |
| name ) |
Yields:
A context within which all the events added to this storage
will be prefixed by the name scope.
Definition at line 422 of file events.py.
| fastreid.utils.events.EventStorage.put_histogram | ( | self, | |
| hist_name, | |||
| hist_tensor, | |||
| bins = 1000 ) |
Create a histogram from a tensor.
Args:
hist_name (str): The name of the histogram to put into tensorboard.
hist_tensor (torch.Tensor): A Tensor of arbitrary shape to be converted
into a histogram.
bins (int): Number of histogram bins.
Definition at line 317 of file events.py.
| fastreid.utils.events.EventStorage.put_image | ( | self, | |
| img_name, | |||
| img_tensor ) |
Add an `img_tensor` associated with `img_name`, to be shown on
tensorboard.
Args:
img_name (str): The name of the image to put into tensorboard.
img_tensor (torch.Tensor or numpy.array): An `uint8` or `float`
Tensor of shape `[channel, height, width]` where `channel` is
3. The image format should be RGB. The elements in img_tensor
can either have values in [0, 1] (float32) or [0, 255] (uint8).
The `img_tensor` will be visualized in tensorboard.
Definition at line 269 of file events.py.
| fastreid.utils.events.EventStorage.put_scalar | ( | self, | |
| name, | |||
| value, | |||
| smoothing_hint = True ) |
Add a scalar `value` to the `HistoryBuffer` associated with `name`.
Args:
smoothing_hint (bool): a 'hint' on whether this scalar is noisy and should be
smoothed when logged. The hint will be accessible through
:meth:`EventStorage.smoothing_hints`. A writer may ignore the hint
and apply custom smoothing rule.
It defaults to True because most scalars we save need to be smoothed to
provide any useful signal.
Definition at line 283 of file events.py.
| fastreid.utils.events.EventStorage.put_scalars | ( | self, | |
| * | smoothing_hint = True, | ||
| ** | kwargs ) |
Put multiple scalars from keyword arguments.
Examples:
storage.put_scalars(loss=my_loss, accuracy=my_accuracy, smoothing_hint=True)
Definition at line 308 of file events.py.
| fastreid.utils.events.EventStorage.smoothing_hints | ( | self | ) |
Returns:
dict[name -> bool]: the user-provided hint on whether the scalar
is noisy and needs smoothing.
Definition at line 387 of file events.py.
| fastreid.utils.events.EventStorage.step | ( | self | ) |
User should call this function at the beginning of each iteration, to notify the storage of the start of a new iteration. The storage will then be able to associate the new data with the correct iteration number.
Definition at line 395 of file events.py.
|
protected |
|
protected |
|
protected |