Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Processing time of the image in seconds.

Usecase example

One of the usecases may be to end evaluation early based on a predetermined condition. In case of a flow containing Parallelism it is possible to stop certain branches and let others freely into evaluation. Notice the following flow:

...

In this case the Classifier module can be used to distinguish two separate parts. On one part it is necessary to detect damaged parts, that’s what the Detector is used for. On a different part it is necessary to detect the expiration date, this is done by OCR.

By implementing a Code module before Detector with the following code:

Code Block
languagepy
def main(context):
    # to get the class look at the previous JSON structure
    # change the string "Expiration Date" based on your real class
    expiration_date_class = context['detectedRectangles'][0]['classNames'][0]['label'] == "Expiration Date"
    if expiration_date_class:
        context['exit'] = True

The important line here is context['exit'] = True. This way it is possible to stop the image from further evaluation, saving time as a result.