Skip to content

Commit

Permalink
add option to hide confidence score
Browse files Browse the repository at this point in the history
  • Loading branch information
zcqian committed Oct 10, 2019
1 parent 8072b8b commit 60fdb58
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion freecam.py
Expand Up @@ -96,6 +96,8 @@ def wnid_to_idx(wnid: str) -> int:
help="produce activation map")
parser.add_argument('--detection', action='store_true',
help="produce object detection map")
parser.add_argument('--no-softmax', action='store_true',
help="do not output softmax value")

args = parser.parse_args()

Expand Down Expand Up @@ -137,7 +139,11 @@ def wnid_to_idx(wnid: str) -> int:
draw = PIL.ImageDraw2.Draw(final_cam_image)
color = 'white'
font = PIL.ImageDraw2.Font(color, args.font, size=14)
draw.text((5, 5), f"{label} {confidence:.4f}", font)
if args.no_softmax:
text = f"{label}"
else:
text = f"{label} {confidence:.4f}"
draw.text((5, 5), text, font)

final_cam_image.save(os.path.join(args.output, f'cam_{pred_idx}.png'))

Expand Down

0 comments on commit 60fdb58

Please sign in to comment.