JustinShenk / fer

Facial Expression Recognition with a deep neural network as a PyPI package
MIT License
350 stars 80 forks source link

Json format of the output #16

Closed redfalcoon closed 4 years ago

redfalcoon commented 4 years ago

Justin,

using the fer application applied to an image the result that I obtain seem do not accomplish with the json standard. This is an example:

[OrderedDict([('box', (316, -3, 516, 516)), ('emotions', {'angry': 0.88, 'disgust': 0.0, 'fear': 0.06, 'happy': 0.0, 'sad': 0.03, 'surprise': 0.0, 'neutral': 0.03})])]

using the json.dumps function to pretty print the above result, I got an error message. Any idea? Thanks.

JustinShenk commented 4 years ago

Thanks for your message. This has been fixed in v20.1.1. OrderedDict has been replaced with dict and numpy floats have been cast to native Python floats to allow Json parsing.

Please try pip install -U fer, then import pprint; pprint.pprint(result) or import json; json.dumps(result).

On Mon, Nov 9, 2020 at 7:04 PM redfalcoon notifications@github.com wrote:

Justin,

using the fer application applied to an image the result that I obtain seem do not accomplish with the json standard. This is an example:

[OrderedDict([('box', (316, -3, 516, 516)), ('emotions', {'angry': 0.88, 'disgust': 0.0, 'fear': 0.06, 'happy': 0.0, 'sad': 0.03, 'surprise': 0.0, 'neutral': 0.03})])]

using the json.dumps function to pretty print the above result, I got an error message. Any idea? Thanks.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/justinshenk/fer/issues/16, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACOLMZH6JY2IG7Z7Y3BLEYLSPAVMDANCNFSM4TPVWFAA .

JustinShenk commented 4 years ago

Closing issue

redfalcoon commented 4 years ago

Justin,

thank you for your response and the correction that works fine and solve the issue. Nice job.