Shortcuts

mmcv.ops.pixel_group

mmcv.ops.pixel_group(score: Union[numpy.ndarray, torch.Tensor], mask: Union[numpy.ndarray, torch.Tensor], embedding: Union[numpy.ndarray, torch.Tensor], kernel_label: Union[numpy.ndarray, torch.Tensor], kernel_contour: Union[numpy.ndarray, torch.Tensor], kernel_region_num: int, distance_threshold: float)List[List[float]][source]

Group pixels into text instances, which is widely used text detection methods.

Parameters
  • score (np.array or torch.Tensor) – The foreground score with size hxw.

  • mask (np.array or Tensor) – The foreground mask with size hxw.

  • embedding (np.array or torch.Tensor) – The embedding with size hxwxc to distinguish instances.

  • kernel_label (np.array or torch.Tensor) – The instance kernel index with size hxw.

  • kernel_contour (np.array or torch.Tensor) – The kernel contour with size hxw.

  • kernel_region_num (int) – The instance kernel region number.

  • distance_threshold (float) – The embedding distance threshold between kernel and pixel in one instance.

Returns

The instance coordinates and attributes list. Each element consists of averaged confidence, pixel number, and coordinates (x_i, y_i for all pixels) in order.

Return type

list[list[float]]