Acoustic identification of individual animals with hierarchical contrastive learning