phungthanhtu's picture
seed 5
444d789 verified
Raw History Blame Contribute Delete
691 Bytes
"""Predict the expression of one or more images with a published model.
python example.py ../../face.jpg
python example.py a.jpg b.jpg --repo phungthanhtu/rafdb-fer-adacm-4000
"""
import argparse
import model
def main():
ap = argparse.ArgumentParser()
ap.add_argument("images", nargs="+")
ap.add_argument("--repo", default="phungthanhtu/rafdb-fer-supervised-4000")
args = ap.parse_args()
net = model.load(args.repo)
print(f"{args.repo}")
for path in args.images:
print(path)
for name, prob in model.predict(net, path):
print(f" {name:<10s} {prob:.3f}")
if __name__ == "__main__":
main()