jina.helloworld.fashion.my_executors module

class jina.helloworld.fashion.my_executors.MyIndexer(**kwargs)[source]

Bases: jina.executors.BaseExecutor

Executor with basic exact search using cosine distance

metas and requests are always auto-filled with values from YAML config.

Parameters
  • metas – a dict of metas fields

  • requests – a dict of endpoint-function mapping

  • runtime_args – a dict of arguments injected from Runtime during runtime

  • kwargs – additional extra keyword arguments to avoid failing when extra params ara passed that are not expected

index(docs, **kwargs)[source]

Extend self._docs

Parameters
  • docs (DocumentArray) – DocumentArray containing Documents

  • kwargs – other keyword arguments

search(docs, parameters, **kwargs)[source]

Append best matches to each document in docs

Parameters
  • docs (DocumentArray) – documents that are searched

  • parameters (Dict) – dictionary of pairs (parameter,value)

  • kwargs – other keyword arguments

requests = {'/eval': <function MyIndexer.search>, '/index': <function MyIndexer.index>, '/search': <function MyIndexer.search>}
class jina.helloworld.fashion.my_executors.MyEncoder(**kwargs)[source]

Bases: jina.executors.BaseExecutor

Encode data using SVD decomposition

metas and requests are always auto-filled with values from YAML config.

Parameters
  • metas – a dict of metas fields

  • requests – a dict of endpoint-function mapping

  • runtime_args – a dict of arguments injected from Runtime during runtime

  • kwargs – additional extra keyword arguments to avoid failing when extra params ara passed that are not expected

encode(docs, **kwargs)[source]

Encode the data using an SVD decomposition

Parameters
  • docs (DocumentArray) – input documents to update with an embedding

  • kwargs – other keyword arguments

requests = {'/default': <function MyEncoder.encode>}
class jina.helloworld.fashion.my_executors.MyConverter(metas=None, requests=None, runtime_args=None, **kwargs)[source]

Bases: jina.executors.BaseExecutor

Convert DocumentArrays removing blob and reshaping blob as image

metas and requests are always auto-filled with values from YAML config.

Parameters
  • metas (Optional[Dict]) – a dict of metas fields

  • requests (Optional[Dict]) – a dict of endpoint-function mapping

  • runtime_args (Optional[Dict]) – a dict of arguments injected from Runtime during runtime

  • kwargs – additional extra keyword arguments to avoid failing when extra params ara passed that are not expected

convert(docs, **kwargs)[source]

Remove blob and reshape documents as squared images :type docs: DocumentArray :param docs: documents to modify :param kwargs: other keyword arguments

requests = {'/default': <function MyConverter.convert>}
class jina.helloworld.fashion.my_executors.MyEvaluator(**kwargs)[source]

Bases: jina.executors.BaseExecutor

Executor that evaluates precision and recall

metas and requests are always auto-filled with values from YAML config.

Parameters
  • metas – a dict of metas fields

  • requests – a dict of endpoint-function mapping

  • runtime_args – a dict of arguments injected from Runtime during runtime

  • kwargs – additional extra keyword arguments to avoid failing when extra params ara passed that are not expected

property avg_precision

Computes precision :return: precision values

property avg_recall

Computes recall :return: np.ndarray with recall values

evaluate(docs, groundtruths, **kwargs)[source]

Evaluate documents using the class values from ground truths

Parameters
  • docs (DocumentArray) – documents to evaluate

  • groundtruths (DocumentArray) – ground truth for the documents

  • kwargs – other keyword arguments

requests = {'/eval': <function MyEvaluator.evaluate>}