提交 d8a42036 编写于 作者: G gaotingquan 提交者: Tingquan Gao

Fix printing prediction

上级 a2376ee1
...@@ -279,8 +279,13 @@ def args_cfg(): ...@@ -279,8 +279,13 @@ def args_cfg():
"--save_dir", "--save_dir",
type=str, type=str,
help="The directory to save prediction results as pre-label.") help="The directory to save prediction results as pre-label.")
parser.add_argument("--resize_short", type=int, default=256, help="") parser.add_argument(
parser.add_argument("--crop_size", type=int, default=224, help="") "--resize_short",
type=int,
default=256,
help="Resize according to short size.")
parser.add_argument(
"--crop_size", type=int, default=224, help="Centor crop size.")
args = parser.parse_args() args = parser.parse_args()
return vars(args) return vars(args)
...@@ -506,12 +511,12 @@ class PaddleClas(object): ...@@ -506,12 +511,12 @@ class PaddleClas(object):
preds = self.cls_predictor.postprocess(outputs, preds = self.cls_predictor.postprocess(outputs,
img_path_list) img_path_list)
if print_pred and preds: if print_pred and preds:
for nu, pred in enumerate(preds): for pred in preds:
filename = pred.pop("file_name")
pred_str = ", ".join( pred_str = ", ".join(
[f"{k}: {pred[k]}" for k in pred]) [f"{k}: {pred[k]}" for k in pred])
print( print(
f"filename: {img_path_list[nu]}, top-{topk}, {pred_str}" f"filename: {filename}, top-{topk}, {pred_str}")
)
img_list = [] img_list = []
img_path_list = [] img_path_list = []
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册