Skip to content

nanoowl is broken by updated dependencies giving error cv2.error in owl_drawing.py #45

@SeanCondon

Description

@SeanCondon

As described in this forum thread nanoowl gives this error:

Traceback (most recent call last):
  File "/opt/nanoowl/examples/owl_predict.py", line 88, in <module>
    image = draw_owl_output(image, output, text=text, draw_text=True)
  File "/opt/nanoowl/nanoowl/owl_drawing.py", line 51, in draw_owl_output
    cv2.rectangle(
cv2.error: OpenCV(4.11.0) :-1: error: (-5:Bad argument) in function 'rectangle'
> Overload resolution failed:
>  - img marked as output argument, but provided NumPy array marked as readonly
>  - img marked as output argument, but provided NumPy array marked as readonly
>  - Expected Ptr<cv::UMat> for argument 'img'
>  - Expected Ptr<cv::UMat> for argument 'img'

when running with the docker image dustynv/nanoowl:r36.4.0 pulled from Nvidia's own registry.

This can be easily reproduced by building the docker image locally by running jetson-containers build nanoowl where the tests fail with:

[00:21:59] Failed building:  nanoowl

Traceback (most recent call last):
  File "/home/scondon/jetson-containers/jetson_containers/build.py", line 129, in <module>
    build_container(**vars(args))
  File "/home/scondon/jetson-containers/jetson_containers/container.py", line 240, in build_container
    test_container(container_name, pkg, simulate, build_idx=idx)
  File "/home/scondon/jetson-containers/jetson_containers/container.py", line 426, in test_container
    status = subprocess.run(cmd.replace(_NEWLINE_, ' '), executable='/bin/bash', shell=True, check=True)
  File "/usr/lib/python3.10/subprocess.py", line 526, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command 'docker run -t --rm --network=host --privileged --runtime=nvidia   --volume /home/scondon/jetson
-containers/packages/vit/nanoowl:/test   --volume /home/scondon/jetson-containers/data:/data   nanoowl:r36.4.tegra-aarch64-cu126-22.04-
nanoowl     /bin/bash -c '/bin/bash /test/test.sh' 2>&1 | tee /home/scondon/jetson-containers/logs/20250729_213533/test/23-1_nanoowl_r3
6.4.tegra-aarch64-cu126-22.04-nanoowl_test.sh.txt; exit ${PIPESTATUS[0]}' returned non-zero exit status 1.

I suspect what's going on here is that some dependency is updated since this was created originally 2 years ago, and has a problem passing in readonly numpy arrays for cv2.rectangle. I will create a PR to try to fix this

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions