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

Panoptic driving Perception (YOLOPv2)

https://github.com/CAIC-AD/YOLOPv2

https://arxiv.org/abs/2208.11434
YOLOPv2: Better, Faster, Stronger for Panoptic Driving Perception

 

0. Rosbag to mp4

sip2@sip2-2021:~/catkin_od/src/object_detection/scripts/YOLOPv2$ cd ~
sip2@sip2-2021:~$ cd sample_code/
PythonRobotics/ rosbag2video/   
sip2@sip2-2021:~/sample_code/rosbag2video$ ./rosbag2video.py --topic /camera/color/image_raw /media/sip2/SIP2022/2022-09-16-iam-5.bag
############# UNCOMPRESSED IMAGE ######################
/camera/color/image_raw  with datatype: sensor_msgs/Image

finished653 fps=297 q=28.0 size=   27392kB time=00:05:43.64 bitrate= 653.0kbits/s speed=11.8x    
frame= 8798 fps=294 q=-1.0 Lsize=   28093kB time=00:05:51.80 bitrate= 654.2kbits/s speed=11.7x  
 

 

1. YOLOPv2

sip2@sip2-2021:~$ source ~/anaconda3/etc/profile.d/conda.sh
sip2@sip2-2021:~$ 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

sip2@sip2-2021:~$ conda create -n py38-torch1-12-1-gpu-yolopv2 --clone py38-torch1-12-1
Source:      /home/sip2/anaconda3/envs/py38-torch1-12-1
Destination: /home/sip2/anaconda3/envs/py38-torch1-12-1-gpu-yolopv2
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-yolopv2
#
# To deactivate an active environment, use
#
#     $ conda deactivate

(py38-torch1-12-1-gpu-yolopv2) sip2@sip2-2021:~/catkin_od/src/object_detection/scripts$ git clone https://github.com/CAIC-AD/YOLOPv2.git
Cloning into 'YOLOPv2'...
remote: Enumerating objects: 162, done.
remote: Counting objects: 100% (49/49), done.
remote: Compressing objects: 100% (44/44), done.
remote: Total 162 (delta 34), reused 6 (delta 5), pack-reused 113
Receiving objects: 100% (162/162), 57.29 MiB | 8.22 MiB/s, done.
Resolving deltas: 100% (60/60), done.

(py38-torch1-12-1-gpu-yolopv2) sip2@sip2-2021:~/catkin_od/src/object_detection/scripts$ cd YOLOPv2/

 

(py38-torch1-12-1-gpu-yolopv2) sip2@sip2-2021:~/catkin_od/src/object_detection/scripts/YOLOPv2$ pip install -r requirements.txt

# Usage: pip install -r requirements.txt

# Base ----------------------------------------
matplotlib>=3.2.2
numpy>=1.18.5
opencv-python>=4.1.1
Pillow>=7.1.2
PyYAML>=5.3.1
requests>=2.23.0
scipy>=1.4.1
torch>=1.7.0
torchvision>=0.8.1,!=0.13.0
tqdm>=4.41.0
protobuf<4.21.3

# Logging -------------------------------------
tensorboard>=2.4.1
# wandb

# Plotting ------------------------------------
pandas>=1.1.4
seaborn>=0.11.0

# Export --------------------------------------
# coremltools>=4.1 # CoreML export
# onnx>=1.9.0 # ONNX export
# onnx-simplifier>=0.3.6 # ONNX simplifier
# scikit-learn==0.19.2 # CoreML quantization
# tensorflow>=2.4.1 # TFLite export
# tensorflowjs>=3.9.0 # TF.js export
# openvino-dev # OpenVINO export

# Extras --------------------------------------
ipython # interactive notebook
psutil # system utilization
thop # FLOPs computation
# albumentations>=1.0.3
# pycocotools>=2.0 # COCO mAP
# roboflow


(py38-torch1-12-1-gpu-yolopv2) sip2@sip2-2021:~/catkin_od/src/object_detection/scripts/YOLOPv2$ python demo.py  --source data/example.jpg


Namespace(agnostic_nms=False, classes=None, conf_thres=0.3, device='0', exist_ok=False, img_size=640, iou_thres=0.45, name='exp', nosave=False, project='runs/detect', save_conf=False, save_txt=False, source='data/example.jpg', weights='data/weights/yolopv2.pt')
/home/sip2/anaconda3/envs/py38-torch1-12-1-gpu-yolopv2/lib/python3.8/site-packages/torch/functional.py:478: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at  /opt/conda/conda-bld/pytorch_1659484683044/work/aten/src/ATen/native/TensorShape.cpp:2894.)
  return _VF.meshgrid(tensors, **kwargs)  # type: ignore[attr-defined]
384x640 Done. (1.498s)
 The image with the result is saved in: runs/detect/exp/example.jpg
inf : (1.4985s/frame)   nms : (0.0059s/frame)
Done. (1.566s)






コメント

このブログの人気の投稿

[참고] 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