code: def _count_edges(act1, act2, impostors, targets):
      imp = impostors[0, act1]
      c = Counter(zip(imp, targets[imp]))
      imp = impostors[1, act2]
      c.update(zip(imp, targets[imp]))
      if c:
          active_pairs = np.array(list(c.keys()))
      else:
          active_pairs = np.empty((0, 2), dtype=int)
      return active_pairs, np.array(list(c.values()))
  
file_path: metric-learn/metric_learn/lmnn.py
imports: import numpy
  from collections import Counter
  from sklearn.metrics import euclidean_distances
  from sklearn.base import TransformerMixin
  import warnings
  from ._util import _initialize_components, _check_n_components
  from .base_metric import MahalanobisMixin
label_desc: Use image node_id 2 for calling a global function with example usage: _count_edges(act1, act2, impostors, targets) and returns: active_pairs,  np