MCPcopy Create free account
hub / github.com/ChenHsing/SVFormer / __init__

Method __init__

timesformer/visualization/tensorboard_vis.py:24–87  ·  view source on GitHub ↗

Args: cfg (CfgNode): configs. Details can be found in slowfast/config/defaults.py

(self, cfg)

Source from the content-addressed store, hash-verified

22 """
23
24 def __init__(self, cfg):
25 """
26 Args:
27 cfg (CfgNode): configs. Details can be found in
28 slowfast/config/defaults.py
29 """
30 # class_names: list of class names.
31 # cm_subset_classes: a list of class ids -- a user-specified subset.
32 # parent_map: dictionary where key is the parent class name and
33 # value is a list of ids of its children classes.
34 # hist_subset_classes: a list of class ids -- user-specified to plot histograms.
35 (
36 self.class_names,
37 self.cm_subset_classes,
38 self.parent_map,
39 self.hist_subset_classes,
40 ) = (None, None, None, None)
41 self.cfg = cfg
42 self.cm_figsize = cfg.TENSORBOARD.CONFUSION_MATRIX.FIGSIZE
43 self.hist_figsize = cfg.TENSORBOARD.HISTOGRAM.FIGSIZE
44
45 if cfg.TENSORBOARD.LOG_DIR == "":
46 log_dir = os.path.join(
47 cfg.OUTPUT_DIR, "runs-{}".format(cfg.TRAIN.DATASET)
48 )
49 else:
50 log_dir = os.path.join(cfg.OUTPUT_DIR, cfg.TENSORBOARD.LOG_DIR)
51
52 self.writer = SummaryWriter(log_dir=log_dir)
53 logger.info(
54 "To see logged results in Tensorboard, please launch using the command \
55 `tensorboard --port=<port-number> --logdir {}`".format(
56 log_dir
57 )
58 )
59
60 if cfg.TENSORBOARD.CLASS_NAMES_PATH != "":
61 if cfg.DETECTION.ENABLE:
62 logger.info(
63 "Plotting confusion matrix is currently \
64 not supported for detection."
65 )
66 (
67 self.class_names,
68 self.parent_map,
69 self.cm_subset_classes,
70 ) = get_class_names(
71 cfg.TENSORBOARD.CLASS_NAMES_PATH,
72 cfg.TENSORBOARD.CATEGORIES_PATH,
73 cfg.TENSORBOARD.CONFUSION_MATRIX.SUBSET_PATH,
74 )
75
76 if cfg.TENSORBOARD.HISTOGRAM.ENABLE:
77 if cfg.DETECTION.ENABLE:
78 logger.info(
79 "Plotting histogram is not currently \
80 supported for detection tasks."
81 )

Callers

nothing calls this directly

Calls 1

get_class_namesFunction · 0.90

Tested by

no test coverage detected