MCPcopy Create free account
hub / github.com/PeizeSun/SparseR-CNN / __init__

Method __init__

detectron2/export/api.py:72–91  ·  view source on GitHub ↗

Args: cfg (CfgNode): a detectron2 config, with extra export-related options added by :func:`add_export_config`. model (nn.Module): a model built by :func:`detectron2.modeling.build_model`. Weights have to be already loa

(self, cfg, model, inputs)

Source from the content-addressed store, hash-verified

70 """
71
72 def __init__(self, cfg, model, inputs):
73 """
74 Args:
75 cfg (CfgNode): a detectron2 config, with extra export-related options
76 added by :func:`add_export_config`.
77 model (nn.Module): a model built by
78 :func:`detectron2.modeling.build_model`. Weights have to be already
79 loaded to this model.
80 inputs: sample inputs that the given model takes for inference.
81 Will be used to trace the model. Random input with no detected objects
82 will not work if the model has data-dependent control flow (e.g., R-CNN).
83 """
84 assert isinstance(cfg, CN), cfg
85 assert isinstance(model, torch.nn.Module), type(model)
86 if "EXPORT_CAFFE2" not in cfg:
87 cfg = add_export_config(cfg) # will just the defaults
88
89 self.cfg = cfg
90 self.model = model
91 self.inputs = inputs
92
93 def _get_traceable(self):
94 # TODO how to make it extensible to support custom models

Callers

nothing calls this directly

Calls 1

add_export_configFunction · 0.85

Tested by

no test coverage detected