Hi Bruno, to solve this problem take a look in the public engines here:

Custom serializer definition:
https://github.com/marvin-ai/marvin-public-engines/blob/master/image-classification-engine/marvin_image_classification_engine/model_serializer.py
Usage of the custom serializer:
https://github.com/marvin-ai/marvin-public-engines/blob/master/image-classification-engine/marvin_image_classification_engine/training/trainer.py
https://github.com/marvin-ai/marvin-public-engines/blob/master/image-classification-engine/marvin_image_classification_engine/prediction/predictor.py

Basically, Marvin gives you the power of creating your own serializable, in
this case, I am just using Keras default serializer.

By default we already have a Keras serializer inside de tools box, you just
to have to use it:

Here is the serializer:
https://github.com/marvin-ai/marvin-python-toolbox/blob/master/marvin_python_toolbox/engine_base/serializers/keras_serializer.py
You just have to extend it from your Predictor and Trainer classes to use
it.


Em ter., 26 de nov. de 2019 às 07:22, Bruno Sette (Jira) <j...@apache.org>
escreveu:

> Bruno Sette created MARVIN-70:
> ---------------------------------
>
>              Summary: Keras predictor preparator (image) nparray  is not
> JSON serializable problem
>                  Key: MARVIN-70
>                  URL: https://issues.apache.org/jira/browse/MARVIN-70
>              Project: Apache Marvin
>           Issue Type: Bug
>             Reporter: Bruno Sette
>
>
> Hi guys,
>
> I'm having a problem with predictor preparator in dryrun. Keras predictor
> needs to convert images to nparray, a type wich its not json serializable.
> I've tried to convert the nparray to a python list, but this doesn't work
> well because it is a multidimensional array. Any ideas on how to solve this?
>
>
>
> Thanks.
> {code:java}
>
>
> ------------------------------------------------------------------------------
> MARVIN DRYRUN - STEP [PredictionPreparator]
>
> ------------------------------------------------------------------------------
>
> Message 0 :
> "http://datawrangling.s3.amazonaws.com/sample_digit.png";
> Result for Message 0 :
> Unable to serialize the object returned!
> {code}
>
>
>
>
>
>
>
>
>
>
> --
> This message was sent by Atlassian Jira
> (v8.3.4#803005)
>

Reply via email to