Cedric-Perauer / object_detection-

Repo for object detection/localization in ROS with Intel Realsense camera

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

object_detection-

Repo for object detection/localization in ROS with Intel Realsense camera

Setup

Requirements

1) Install ROS melodic

  • Follow the guide here to install ROS melodic
  • paste this into the terminal to install catkin build tools :
sudo apt-get install python-catkin-tools

2) Install Torch (used to run neural network inference)

  • Go to the Nvidia Website here and download the PyTorch v1.8.0 .whl file
  • extract the folder in the home directory and rename it to torch (so the compiler can find it)
  • after that the torch folder will be in your home directory (see below)

follow the other instructions made in the installation section by Nvidia :

wget https://nvidia.box.com/shared/static/p57jwntv436lfrd78inwl7iml6p13fzh.whl -O torch-1.8.0-cp36-cp36m-linux_aarch64.whl
sudo apt-get install python3-pip libopenblas-base libopenmpi-dev 
pip3 install Cython
pip3 install numpy torch-1.8.0-cp36-cp36m-linux_aarch64.whl

After that torch should be installed

Install

1) Create a folder called CATKIN_FS/src/ in your home directory :

mkdir -p CATKIN_FS/src/

2) Clone the repo

git clone https://github.com/Cedric-Perauer/object_detection-.git

3) Move files from the object_detection- folder to the CATKIN_FS/src/ folder :

mv object_detection-/* CATKIN_FS/src/

4) go into the CATKIN_FS directory and build the project with catkin build :

cd CATKIN_FS/ 
catkin build 

5) generate the .engine file :

TODO

6) Change the Line 65 in camera_node/src/yolov5.cpp to point to the .engine file location (replace user name with your username) :

 engine_name = "/home/<user_name>/CATKIN_FS/src/camera_node/src/yolov5s.engine";

do a similar thing in the file camera_node/src/camera_node.cpp (line 23)

std::string paramsFilePath = "/home/<user_name>/CATKIN_FS/camera_node/src/params.txt";

6) go into the CATKIN_FS directory and build the project with catkin build :

cd CATKIN_FS/ 
catkin build 

=> When the build is successful you can download the rosbag file using this link

go into the downloads directory where the .bag file is located and run it with :

rosbag play -l camera.bag 

start the camera_node wit :

rosrun camera_node camera_node 

then you should see an image window openig that looks like this :

Potential Issues Fix :

  • If you run into an issue regarding boost (python_boost) or opencv follow these steps :

1) install OpenCv3 version (paste into terminal) :

sudo apt install libopencv-dev=3.2.0+dfsg-4ubuntu0.1

2) Change the 2 files below :

Commenting row 11 12 in the CMakeLists.txt in the folder vision_opencv/cv_bridge/

if(PYTHONLIBS_VERSION_STRING VERSION_LESS "3.8")
    # Debian Buster
    #find_package(Boost REQUIRED python37)
    #else()
    # Ubuntu Focal
    find_package(Boost REQUIRED python)
  endif()

And adding 0 at the #define NUMPY_IMPORT_ARRAY_RETVAL in the file /usr/include/python2.7/numpy/__multiarray_api.h

About

Repo for object detection/localization in ROS with Intel Realsense camera


Languages

Language:Jupyter Notebook 79.8%Language:C++ 10.5%Language:Python 7.9%Language:Cuda 0.9%Language:CMake 0.3%Language:C 0.2%Language:EmberScript 0.2%Language:Shell 0.2%Language:Dockerfile 0.0%