From 88e6387b2c55cc853695213995a37b6b78acd55b Mon Sep 17 00:00:00 2001 From: weishengyu Date: Tue, 25 Jan 2022 15:33:44 +0800 Subject: [PATCH] add label_list file --- ppcls/utils/gallery2fc.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ppcls/utils/gallery2fc.py b/ppcls/utils/gallery2fc.py index 43e7ce1e..67b08529 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) -- GitLab