スキップしてメイン コンテンツに移動

Panoptic driving Perception (HybridNets-ONNX)

#ONNX-HybridNets-Multitask-Road-Detection

https://github.com/ibaiGorordo/ONNX-HybridNets-Multitask-Road-Detection

 

#pretrained weights

https://github.com/PINTO0309/PINTO_model_zoo/tree/main/276_HybridNets

https://drive.google.com/uc?export=download&id=1r1jDtJhi-5KfyMOee0CEbAC-N_hmf8t7

 

#How do you run a ONNX model on a GPU?

https://stackoverflow.com/questions/64452013/how-do-you-run-a-onnx-model-on-a-gpu

 

sip2@sip2-2021:~$ cd catkin_od/src/object_detection/scripts/


sip2@sip2-2021:~/catkin_od/src/object_detection/scripts$ git clone https://github.com/ibaiGorordo/ONNX-HybridNets-Multitask-Road-Detection.git
Cloning into 'ONNX-HybridNets-Multitask-Road-Detection'...
remote: Enumerating objects: 109, done.
remote: Counting objects: 100% (109/109), done.
remote: Compressing objects: 100% (81/81), done.
remote: Total 109 (delta 54), reused 57 (delta 18), pack-reused 0
Receiving objects: 100% (109/109), 20.49 MiB | 11.02 MiB/s, done.
Resolving deltas: 100% (54/54), done.


sip2@sip2-2021:~/catkin_od/src/object_detection/scripts/ONNX-HybridNets-Multitask-Road-Detection/models$ tar -zxvf resources.tar.gz

sip2@sip2-2021:~/catkin_od/src/object_detection/scripts/ONNX-HybridNets-Multitask-Road-Detection$ source ~/anaconda3/etc/profile.d/conda.sh
sip2@sip2-2021:~/catkin_od/src/object_detection/scripts/ONNX-HybridNets-Multitask-Road-Detection$ conda info --e
# conda environments:
#
base                  *  /home/sip2/anaconda3
py38-test                /home/sip2/anaconda3/envs/py38-test
py38-torch1-12-1         /home/sip2/anaconda3/envs/py38-torch1-12-1
py38-torch1-12-1-gpu-od     /home/sip2/anaconda3/envs/py38-torch1-12-1-gpu-od
py38-torch1-12-1-gpu-yolopv2     /home/sip2/anaconda3/envs/py38-torch1-12-1-gpu-yolopv2
py38-torch1-12-1-pythonrobotics     /home/sip2/anaconda3/envs/py38-torch1-12-1-pythonrobotics

sip2@sip2-2021:~/catkin_od/src/object_detection/scripts/ONNX-HybridNets-Multitask-Road-Detection$ conda create -n py38-torch1-12-1-gpu-hybridnets-onnx --clone py38-torch1-12-1
Source:      /home/sip2/anaconda3/envs/py38-torch1-12-1
Destination: /home/sip2/anaconda3/envs/py38-torch1-12-1-gpu-hybridnets-onnx
Packages: 65
Files: 0
Preparing transaction: done
Verifying transaction: |
SafetyError: The package for pytorch located at /home/sip2/anaconda3/pkgs/pytorch-1.12.1-py3.8_cuda11.6_cudnn8.3.2_0
appears to be corrupted. The path 'lib/python3.8/site-packages/torch/nn/modules/upsampling.py'
has an incorrect size.
  reported size: 11056 bytes
  actual size: 11005 bytes


done
Executing transaction: - By downloading and using the CUDA Toolkit conda packages, you accept the terms and conditions of the CUDA End User License Agreement (EULA): https://docs.nvidia.com/cuda/eula/index.html

done
#
# To activate this environment, use
#
#     $ conda activate py38-torch1-12-1-gpu-hybridnets-onnx
#
# To deactivate an active environment, use
#
#     $ conda deactivate

sip2@sip2-2021:~/catkin_od/src/object_detection/scripts/ONNX-HybridNets-Multitask-Road-Detection$ conda activate py38-torch1-12-1-gpu-hybridnets-onnx
(py38-torch1-12-1-gpu-hybridnets-onnx) sip2@sip2-2021:~/catkin_od/src/object_detection/scripts/ONNX-HybridNets-Multitask-Road-Detection$ pip install -r requirements.txt
Collecting opencv-python
  Using cached opencv_python-4.6.0.66-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (60.9 MB)
Collecting onnx
  Downloading onnx-1.12.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (13.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 13.1/13.1 MB 14.4 MB/s eta 0:00:00
Collecting onnxruntime
  Downloading onnxruntime-1.12.1-cp38-cp38-manylinux_2_27_x86_64.whl (4.9 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.9/4.9 MB 15.8 MB/s eta 0:00:00
Collecting onnxoptimizer
  Downloading onnxoptimizer-0.3.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (601 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 601.1/601.1 kB 16.4 MB/s eta 0:00:00
Collecting onnxruntime-gpu
  Downloading onnxruntime_gpu-1.12.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (111.0 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 111.0/111.0 MB 13.9 MB/s eta 0:00:00
Collecting imread-from-url
  Downloading imread_from_url-0.1.3.tar.gz (7.6 kB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: numpy>=1.14.5 in /home/sip2/anaconda3/envs/py38-torch1-12-1-gpu-hybridnets-onnx/lib/python3.8/site-packages (from opencv-python->-r requirements.txt (line 1)) (1.23.1)
Requirement already satisfied: typing-extensions>=3.6.2.1 in /home/sip2/.local/lib/python3.8/site-packages (from onnx->-r requirements.txt (line 2)) (4.3.0)
Collecting protobuf<=3.20.1,>=3.12.2
  Downloading protobuf-3.20.1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl (1.0 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.0/1.0 MB 13.8 MB/s eta 0:00:00
Collecting packaging
  Using cached packaging-21.3-py3-none-any.whl (40 kB)
Collecting sympy
  Downloading sympy-1.11.1-py3-none-any.whl (6.5 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 6.5/6.5 MB 17.0 MB/s eta 0:00:00
Collecting flatbuffers
  Downloading flatbuffers-2.0.7-py2.py3-none-any.whl (26 kB)
Collecting coloredlogs
  Downloading coloredlogs-15.0.1-py2.py3-none-any.whl (46 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 46.0/46.0 kB 17.7 MB/s eta 0:00:00
Requirement already satisfied: Pillow>=6.1.0 in /home/sip2/anaconda3/envs/py38-torch1-12-1-gpu-hybridnets-onnx/lib/python3.8/site-packages (from imread-from-url->-r requirements.txt (line 6)) (8.2.0)
Requirement already satisfied: requests>=2.22.0 in /home/sip2/anaconda3/envs/py38-torch1-12-1-gpu-hybridnets-onnx/lib/python3.8/site-packages (from imread-from-url->-r requirements.txt (line 6)) (2.28.1)
Collecting fake-useragent>=0.1.11
  Downloading fake-useragent-0.1.11.tar.gz (13 kB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: certifi>=2017.4.17 in /home/sip2/anaconda3/envs/py38-torch1-12-1-gpu-hybridnets-onnx/lib/python3.8/site-packages (from requests>=2.22.0->imread-from-url->-r requirements.txt (line 6)) (2022.6.15.2)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /home/sip2/anaconda3/envs/py38-torch1-12-1-gpu-hybridnets-onnx/lib/python3.8/site-packages (from requests>=2.22.0->imread-from-url->-r requirements.txt (line 6)) (1.26.11)
Requirement already satisfied: charset-normalizer<3,>=2 in /home/sip2/anaconda3/envs/py38-torch1-12-1-gpu-hybridnets-onnx/lib/python3.8/site-packages (from requests>=2.22.0->imread-from-url->-r requirements.txt (line 6)) (2.1.1)
Requirement already satisfied: idna<4,>=2.5 in /home/sip2/anaconda3/envs/py38-torch1-12-1-gpu-hybridnets-onnx/lib/python3.8/site-packages (from requests>=2.22.0->imread-from-url->-r requirements.txt (line 6)) (3.3)
Collecting humanfriendly>=9.1
  Downloading humanfriendly-10.0-py2.py3-none-any.whl (86 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 86.8/86.8 kB 24.5 MB/s eta 0:00:00
Collecting pyparsing!=3.0.5,>=2.0.2
  Using cached pyparsing-3.0.9-py3-none-any.whl (98 kB)
Collecting mpmath>=0.19
  Downloading mpmath-1.2.1-py3-none-any.whl (532 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 532.6/532.6 kB 17.0 MB/s eta 0:00:00
Building wheels for collected packages: imread-from-url, fake-useragent
  Building wheel for imread-from-url (setup.py) ... done
  Created wheel for imread-from-url: filename=imread_from_url-0.1.3-py3-none-any.whl size=6625 sha256=2cafb17e6e289393d121f8b52ed46ac88c935acb4259c4ebfac9b3ccbe13bbc1
  Stored in directory: /home/sip2/.cache/pip/wheels/71/41/3d/3aa650f3ff41087c512c1ff373a3afd3e998efc501f0aca034
  Building wheel for fake-useragent (setup.py) ... done
  Created wheel for fake-useragent: filename=fake_useragent-0.1.11-py3-none-any.whl size=13481 sha256=9afe0dbc45ebbd06bc108187c08b14d0db1866a3abeb318c0f414150996bb355
  Stored in directory: /home/sip2/.cache/pip/wheels/a0/b8/b7/8c942b2c5be5158b874a88195116b05ad124bac795f6665e65
Successfully built imread-from-url fake-useragent
Installing collected packages: mpmath, flatbuffers, fake-useragent, sympy, pyparsing, protobuf, opencv-python, humanfriendly, packaging, onnx, imread-from-url, coloredlogs, onnxruntime-gpu, onnxruntime, onnxoptimizer
Successfully installed coloredlogs-15.0.1 fake-useragent-0.1.11 flatbuffers-2.0.7 humanfriendly-10.0 imread-from-url-0.1.3 mpmath-1.2.1 onnx-1.12.0 onnxoptimizer-0.3.1 onnxruntime-1.12.1 onnxruntime-gpu-1.12.1 opencv-python-4.6.0.66 packaging-21.3 protobuf-3.20.1 pyparsing-3.0.9 sympy-1.11.1

idNets-Multitask-Road-Detection$ pip install youtube_dl
Collecting youtube_dl
  Downloading youtube_dl-2021.12.17-py2.py3-none-any.whl (1.9 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.9/1.9 MB 12.3 MB/s eta 0:00:00
Installing collected packages: youtube_dl
Successfully installed youtube_dl-2021.12.17
(py38-torch1-12-1-gpu-hybridnets-onnx) sip2@sip2-2021:~/catkin_od/src/object_detection/scripts/ONNX-HybridNets-Multitask-Road-Detection$ pip install git+https://github.com/zizo-pro/pafy@b8976f22c19e4ab5515cacbfae0a3970370c102b
Collecting git+https://github.com/zizo-pro/pafy@b8976f22c19e4ab5515cacbfae0a3970370c102b
  Cloning https://github.com/zizo-pro/pafy (to revision b8976f22c19e4ab5515cacbfae0a3970370c102b) to /tmp/pip-req-build-23j70lt7
  Running command git clone --filter=blob:none --quiet https://github.com/zizo-pro/pafy /tmp/pip-req-build-23j70lt7
  Running command git rev-parse -q --verify 'sha^b8976f22c19e4ab5515cacbfae0a3970370c102b'
  Running command git fetch -q https://github.com/zizo-pro/pafy b8976f22c19e4ab5515cacbfae0a3970370c102b
  Resolved https://github.com/zizo-pro/pafy to commit b8976f22c19e4ab5515cacbfae0a3970370c102b
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: pafy
  Building wheel for pafy (setup.py) ... done
  Created wheel for pafy: filename=pafy-0.5.5-py2.py3-none-any.whl size=35687 sha256=d9f418757c08a419527fcacb3cec8dea29927c2931eb745f8d841cfd4e8c88bd
  Stored in directory: /home/sip2/.cache/pip/wheels/c5/db/e1/eb8f267dbfc00df1c24754a1424071b1c1ad8e93443a4aa8bf
Successfully built pafy
Installing collected packages: pafy
Successfully installed pafy-0.5.5

(py38-torch1-12-1-gpu-hybridnets-onnx) sip2@sip2-2021:~/catkin_od/src/object_detection/scripts/ONNX-HybridNets-Multitask-Road-Detection$ python video_bird_eye_view_road_detection.py





コメント

このブログの人気の投稿

[참고] ROS kinetic에서 WebCam 사용하기 (Ubuntu 16.04)

Reference: 1. https://github.com/bosch-ros-pkg/usb_cam/issues/53  2. http://zumashi.blogspot.jp/2016/12/ros-kinetic-usb-cam.html  3. http://cafe.naver.com/openrt/5963 위의 사이트들을 참고하여 ROS Kinetic에서 Logitech WebCam C270의 동작을 확인했습니다. $ cd ~/catkin_ws/src $ git clone https://github.com/bosch-ros-pkg/usb-cam.git $ cd .. $ catkin_make WebCam test $ roscore $ rosrun usb_cam usb_cam_node $ rosrun image_view image_view image:=/usb_cam/image_raw $ rosrun rviz rviz 1) By display type>rviz>image 2) Image topic: /usb_cam/image_raw --> 왼쪽 하단과 같이 WebCam이 잘 동작하는 것을 확인했습니다.

[vscode] TImeout waiting for debugger connection

이제까지 잘 동작하던 비주얼 스튜디오 코드가 위와 같은 에러 메세지를 내면서 갑자기 디버깅이 안되서 인터넷을 검색한 결과.. vscode의 User Setting에서 검색창에 python.terminal.activateEnvironment을 입력하여 true로 설정되어 있는 값을 false로 변환하면 된다. 

Anaconda을 이용하여 ROS + Tensorflow 함께 사용하기

-- CUDA, cuDNN 버전확인 https://stackoverflow.com/questions/41714757/how-to-find-cuda-version-in-ubuntu/42122965 $ nvcc --version cuda8.0, cudnn6.0 -- 아나콘다 python2.7 버전 인스톨 https://www.anaconda.com/download/#linux python3.x이랑 ROS 같이 써보려고 했는데, 아직 실력이 부족해서 그런지 실패.. $ bash Anaconda2-5.3.0-Linux-x86_64.sh $ source ~/.bashrc $ python -V Python 2.7.15 :: Anaconda, Inc. $ conda create -n tf14 pip python=2.7 $ source activate tf14 -- ROS 관련 패키지 인스톨 (tf14) $ pip install --upgrade pip (tf14) $ pip install -U rosinstall msgpack empy defusedxml netifaces --CUDA, cuDNN, CPU/GPU을 사양에 맞춰서 tensorflow download https://github.com/mind/wheels#mkl (tf14) $ pip install tensorflow-1.4.0-cp27-cp27mu-linux_x86_64.whl 잘 설치가 되었는지 Hello, tensorflow 실행 (tf14) $ python Python 2.7.15 |Anaconda, Inc.| (default, May  1 2018, 23:32:55) [GCC 7.2.0] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> i