DIGITS 4 Object Detection Bounding Boxes Visualization Test ValueError

I do not know it is the right place to ask about DIGITS but…
(I thinks Jetson TX2 Forum is more active than others though!)

I am using DIGIT (4 on Ubuntu 14.04) on AWS (https://aws.amazon.com/marketplace/pp/B01LZN28VD).

After I trained an object detection model with custom data, I tried to visualize bounding boxes.
([Select Visualization Method], [Bounding boxes], and [Test One])

But I got ValueError…

    The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

    Traceback (most recent call last):
      File "/usr/lib/python2.7/dist-packages/flask/app.py", line 1475, in full_dispatch_request
        rv = self.dispatch_request()
      File "/usr/lib/python2.7/dist-packages/flask/app.py", line 1461, in dispatch_request
        return self.view_functions[rule.endpoint](**req.view_args)
      File "/usr/share/digits/digits/webapp.py", line 65, in decorated
        return f(*args, **kwargs)
      File "/usr/share/digits/digits/model/images/generic/views.py", line 343, in infer_one
      File "/usr/share/digits/digits/model/images/generic/views.py", line 592, in get_inference_visualizations
      File "/usr/share/digits/digits/extensions/view/boundingBox/view.py", line 124, in process_data
        if output[-1] > 0:
    ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

How can I visualize bounding boxes…?

Hi, does the bounding box visualization work when following this example procedure?

As your issue pertains to the internals of DIGITS, you may wish to file an issue on the DIGITS GitHub repo.
Also if you can, it may be advisable to try using latest master or DIGITS5 branch to see if the behavior changes.

Here’s the line of code in question:

In the meantime you could play around with the output[-1] indexing to debug the issue - print it to see if the dimensions are off.
You may also want to double-check the definitions of your custom classes.

I added the line

raise ValueError(str(output[-1]))

in view.py and I got

ValueError: [ 0.03382327  0.02330605  0.01111413  0.00454773  0.00264979  0.00228123
  0.00196895  0.00164576  0.00169343  0.00283106  0.00601523  0.00706102
  0.00513932  0.00400394  0.00347533  0.00290813  0.00207462  0.00176357
  0.0028231   0.00489662  0.00494111  0.003091    0.00226723  0.00237538
  0.00284034  0.00206759  0.00124427  0.0006563   0.0004154   0.00046173
  0.00062325  0.00081754  0.00101394  0.00167021  0.00312538  0.00385222
  0.00610845  0.01335809  0.03634922  0.07388113]

Any advice?

BTW, how can I restart DIGITS 4 server on AWS from command line?

Maybe change the array index from -1 to the entry with the maximum value?

I believe this may work:

sudo service digits restart

What are output and output[0] supposed to mean?

I believe they are the bbox coordinate offsets and confidence value. The DIGITS team may be able to comment more on that code through their GitHub.

In the file “/usr/share/digits/digits/extensions/view/boundingBox/view.py”,

outputs = inference_data[inference_data.keys()[0]]

# print len(outputs)
# print [len(output) for output in outputs]

# for output in outputs:
for output in outputs[0]:
    # last number is confidence
    if output[-1] > 0:
        box = ((output[0], output[1]), (output[2], output[3]))
        # print box
        self.bbox_count += 1

outputs it a list of only one element.
And the element is a list of 40 lists of 40 elements.
So I changed for output in outputs: (6th line) to for output in outputs[0]: (7th line).
Is it supposed to be correct?
(I cannot verify because my trained model detects very small boxes at the top-left cornet…)


We don’t meet this error with newer DIGITs.
Please upgrade DIGITs to the latest version to get things work.


Would you please remove this topic?

It was my mistake that I removed final python layers from DIGITS…



It’s okay. Thanks for your feedback.