diff --git a/ppcls/utils/gallery2fc.py b/ppcls/utils/gallery2fc.py index 43e7ce1e3ed94b18619ad05c8ae4da910b4ad00c..67b08529ebb37a8a147aa81f3ebb80dc13296624 100644 --- a/ppcls/utils/gallery2fc.py +++ b/ppcls/utils/gallery2fc.py @@ -53,6 +53,12 @@ class GalleryLayer(paddle.nn.Layer): gallery_labels.append(line[1].strip()) self.gallery_layer = paddle.nn.Linear(embedding_size, len(self.gallery_images), bias_attr=False) self.gallery_layer.skip_quant = True + output_label_str = "" + for i, label_i in enumerate(gallery_labels): + output_label_str += "{} {}\n".format(i, label_i) + output_path = configs["Global"]["save_inference_dir"] + "_label.txt" + with open(output_path, "w") as f: + f.write(output_label_str) def forward(self, x, label=None): x = paddle.nn.functional.normalize(x)