def _plot_features(self, features, labels, prefix):
        """Plot features on 2D plane.
        Args:
            features: (num_instances, num_features).
            labels: (num_instances).
        """
        colors = ["C0", "C1", "C2", "C3", "C4", "C5", "C6"]
        for label_idx in range(7):
            plt.scatter(
                features[labels == label_idx, 0],
                features[labels == label_idx, 1],
                c=colors[label_idx],
                s=1,
            )
        plt.legend(["0", "1", "2", "3", "4", "5", "6"], loc="upper right")
        plt_dirname = os.path.join(
            "saved/plot/{}".format(os.path.basename(self._checkpoint_path))
        )
        if not os.path.exists(plt_dirname):
            os.makedirs(plt_dirname, exist_ok=True)

        save_name = os.path.join(
            plt_dirname, "epoch_{}_{}.png".format(self._current_epoch_num, prefix)
        )
        plt.savefig(save_name, bbox_inches="tight")
        plt.close()
Plot features on 2D plane.
        Args:
            features: (num_instances, num_features).
            labels: (num_instances).
        
trainers/centerloss_trainer.py