MCPcopy Create free account
hub / github.com/OpenGVLab/UniFormerV2 / __init__

Method __init__

slowfast/visualization/predictor.py:25–48  ·  view source on GitHub ↗

Args: cfg (CfgNode): configs. Details can be found in slowfast/config/defaults.py gpu_id (Optional[int]): GPU id.

(self, cfg, gpu_id=None)

Source from the content-addressed store, hash-verified

23 """
24
25 def __init__(self, cfg, gpu_id=None):
26 """
27 Args:
28 cfg (CfgNode): configs. Details can be found in
29 slowfast/config/defaults.py
30 gpu_id (Optional[int]): GPU id.
31 """
32 if cfg.NUM_GPUS:
33 self.gpu_id = (
34 torch.cuda.current_device() if gpu_id is None else gpu_id
35 )
36
37 # Build the video model and print model statistics.
38 self.model = build_model(cfg, gpu_id=gpu_id)
39 self.model.eval()
40 self.cfg = cfg
41
42 if cfg.DETECTION.ENABLE:
43 # self.object_detector = Detectron2Predictor(cfg, gpu_id=self.gpu_id)
44 pass
45
46 logger.info("Start loading model weights.")
47 cu.load_test_checkpoint(cfg, self.model)
48 logger.info("Finish loading model weights")
49
50 def __call__(self, task):
51 """

Callers

nothing calls this directly

Calls 1

build_modelFunction · 0.90

Tested by

no test coverage detected