asmirnou / watsor

Object detection for video surveillance
MIT License
252 stars 32 forks source link

Jetson nano 2gb #28

Closed vlewis-vnet closed 1 year ago

vlewis-vnet commented 2 years ago

Good day when running the docker jetson version: docker run -t -i \ --rm \ --env LOG_LEVEL=info \ --volume /etc/localtime:/etc/localtime:ro \ --volume /etc/watsor/config:/etc/watsor:ro \ --publish 8080:8080 \ --shm-size=512m \ --runtime nvidia \ smirnou/watsor.jetson:latest

i am getting an error:

Building TensorRT engine. This may take few minutes. Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/watsor/engine.py", line 80, in model_width=args.model_width, model_height=args.model_height) File "/usr/local/lib/python3.6/dist-packages/watsor/engine.py", line 21, in build_engine builder.max_workspace_size = 1 << 30 AttributeError: 'tensorrt.tensorrt.Builder' object has no attribute 'max_workspace_size' Traceback (most recent call last): File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "/usr/lib/python3.6/runpy.py", line 85, in _run_code exec(code, run_globals) File "/usr/local/lib/python3.6/dist-packages/watsor/main_for_gpu.py", line 24, in ], check=True) File "/usr/lib/python3.6/subprocess.py", line 438, in run output=stdout, stderr=stderr) subprocess.CalledProcessError: Command '['python3', '-u', '/usr/local/lib/python3.6/dist-packages/watsor/engine.py', '-i', '/usr/share/watsor/model/gpu.uff', '-o', '/usr/share/watsor/model/gpu.buf', '-p', '16']' returned non-zero exit status 1. vnet@vnet-jetson:~$ AttributeError: 'tensorrt.tensorrt.Builder' object has no attribute 'max_workspace_size'

can you help me please?

asmirnou commented 2 years ago

Most probably it is concerned with the fact that the latest Jetson Nano system image uses the latest TensorRT 8, where several API were deprecated - Watsor images were build on TensorRT 7. The upgrade to the latest has not been completed yet (PR #24). If possible, downgrading the system image can help. Or wait until Watsor is upgraded, no target date though.

vlewis-vnet commented 2 years ago

okay thank you so much

vlewis-vnet commented 2 years ago

Good day i am using an older jetson image with tensorRT 7.1.3 and i am now getting this error: Building TensorRT engine. This may take few minutes. Traceback (most recent call last): File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "/usr/lib/python3.6/runpy.py", line 85, in _run_code exec(code, run_globals) File "/usr/local/lib/python3.6/dist-packages/watsor/main_for_gpu.py", line 24, in ], check=True) File "/usr/lib/python3.6/subprocess.py", line 438, in run output=stdout, stderr=stderr) subprocess.CalledProcessError: Command '['python3', '-u', '/usr/local/lib/python3.6/dist-packages/watsor/engine.py', '-i', '/usr/share/watsor/model/gpu.uff', '-o', '/usr/share/watsor/model/gpu.buf', '-p', '16']' died with <Signals.SIGKILL: 9>.

can you help with this?

asmirnou commented 2 years ago

My Jetson Nano has 4GB of memory and Watsor works there. I checked that while building TensorRT engine it takes up to 3GB. I guess in your case it fails because 2GB is insufficient.

The following workaround can be tried. After the engine is built it is saved in Docker container file system. Next time the app runs, it doesn't build the engine again, but reuses from file. With the loaded engine and Watsor running Jetson Nano consumes a bit less than 2GB. So if you put an already built engine in /usr/share/watsor/model/gpu.buf of a prepared Docker container, it might work.

I copied TensorRT engines from my setup and uploaded them to Google Drive. There are 2 files: for 32 and 16 float point precision. Only one file is needed. I use the engine with FP16 (Half precision), it show a bit better performance. Rename the file as gpu.buf and put into /usr/share/watsor/model/ folder of Docker container.

asmirnou commented 1 year ago

TensorRT engine can be built by creating a 4GB swapfile as described here: https://github.com/asmirnou/watsor/issues/29#issuecomment-1272590695