hello.mmdet.infer module

pip install mmdet

class hello.mmdet.infer.Detector(config_file, checkpoint_file, device='cuda:0', cfg_options=None)[source]

Bases: object

Instantiate an object detector.

>>> cfg_options = {"data.test.pipeline.1": dict(img_scale=(800, 800), scale_factor=None)}
>>> cfg_options = {"data.test.pipeline.1": dict(img_scale=None, scale_factor=1.0)}
Parameters:
  • config_file (str) – Config file path.

  • checkpoint_file (str) – Checkpoint file path.

  • device (str, optional) – Device used for calculating. Defaults to “cuda:0”.

  • cfg_options (dict, optional) – Options to override some settings. Defaults to None.

test_image(image_path, score_thr=0.3, out_file=None)[source]

Inference image with the detector.

Parameters:

img (str) – Image file.

test_images(images_or_dir, score_thr=0.3, out_dir=None)[source]

Inference images with the detector.

Parameters:

images_or_dir (str or list[str]) – Image files.

to_file(results, txt_file)[source]

Format results.

Such as filepath,height,width,x1,y1,x2,y2,s,l,x1,y1,x2,y2,s,l.

Parameters:

results (list[tuple]) – The results.

hello.mmdet.infer.func(root, config_file, checkpoint_file, cfg_options, images_dir, score_thr, out_dir, txt_file)[source]
hello.mmdet.infer.main(args=None)[source]
hello.mmdet.infer.parse_args(args=None)[source]