def per_target(imgs):
    """Arrange samples per target.
        Args:
            imgs (list): List of (_, target) tuples.
        Returns:
            dict: key (target), value (list of data with this target)
    """
    res = {}
    for index in range(len(imgs)):
        _, target = imgs[index]
        if target not in res:
            res[target] = []
        res[target].append(index)
    return res