|
Safemotion Lib
|
Public Member Functions | |
| __init__ (self, json_file, window_size=20) | |
| write (self) | |
| close (self) | |
Protected Attributes | |
| _file_handle | |
| _window_size | |
| _last_write | |
Write scalars to a json file.
It saves scalars as one json per line (instead of a big json) for easy parsing.
Examples parsing such a json file:
::
$ cat metrics.json | jq -s '.[0:2]'
[
{
"data_time": 0.008433341979980469,
"iteration": 20,
"loss": 1.9228371381759644,
"loss_box_reg": 0.050025828182697296,
"loss_classifier": 0.5316952466964722,
"loss_mask": 0.7236229181289673,
"loss_rpn_box": 0.0856662318110466,
"loss_rpn_cls": 0.48198649287223816,
"lr": 0.007173333333333333,
"time": 0.25401854515075684
},
{
"data_time": 0.007216215133666992,
"iteration": 40,
"loss": 1.282649278640747,
"loss_box_reg": 0.06222952902317047,
"loss_classifier": 0.30682939291000366,
"loss_mask": 0.6970193982124329,
"loss_rpn_box": 0.038663312792778015,
"loss_rpn_cls": 0.1471673548221588,
"lr": 0.007706666666666667,
"time": 0.2490077018737793
}
]
$ cat metrics.json | jq '.loss_mask'
0.7126231789588928
0.689423680305481
0.6776131987571716
...
| fastreid.utils.events.JSONWriter.__init__ | ( | self, | |
| json_file, | |||
| window_size = 20 ) |
Args:
json_file (str): path to the json file. New data will be appended if the file exists.
window_size (int): the window size of median smoothing for the scalars whose
`smoothing_hint` are True.
Definition at line 88 of file events.py.
| fastreid.utils.events.JSONWriter.close | ( | self | ) |
Reimplemented from fastreid.utils.events.EventWriter.
Definition at line 120 of file events.py.
| fastreid.utils.events.JSONWriter.write | ( | self | ) |
Reimplemented from fastreid.utils.events.EventWriter.
Definition at line 99 of file events.py.