# YOLO 설치하기

* **Robot에서만 진행합니다.**

## 설치하기

터미널에서 catkin\_ws/src 폴더로 이동합니다.

![](/files/-MU2wteglRETyrGzwPQx)

darkros 사이트에서 경로를 가져와주세요.

![](/files/-MU2xyYaj0kFs3Q5gAYm)

git clone 명령으로 해당 경로에 있는 패키지를 다운 받습니다.

* &#x20;sudo git clone --recursive <https://github.com/PinkWink/darknet_ros>

![](/files/-MU2y1C2JdZRXz3vV81N)

그 후, workspace로 이동해서 빌드\~

* 이 빌드는 좀 오래 걸려요 ㅜㅜ.

![](/files/-MU2yFE2cHmUp9u2F_8A)

만약 빌드 과정에서 이런 에러가 난다면

![](/files/-MU2ycK9IS2xhrPbiq2s)

해당 파일의 아래 local 부분을 추가해서 수정해주세요\~

* sudo nano /opt/ros/melodic/share/cv\_bridge/cmake/cv\_bridgeConfig.cmake

![](/files/-MU2yhHVWwkiS1xEmIcV)

이제 다운받은 패키지를 적용시키기 위해 source \~/.bashrc를 수행해줍니다.

![](/files/-MU2ysNsi-MsQo8yx5AN)

## 설치 확인하기

{% hint style="info" %}
프롬프트의 hostname을 잘 살피고 따라와주세요.
{% endhint %}

아래 경로의 yolo\_network\_config 폴더로 이동해주세요.

```bash
cd ~/catkin_ws/src/darknet_ros/darknet_ros/yolo_network_config/
```

* 아래 보이는 cfg와 weights 폴더에 뭔가 받아서 저장할 게 있어요\~

![](/files/-MU2z-YIfON4xiF_8qbb)

weights 폴더로 이동해서

![](/files/-MU2z6dygCGlzzIIyEEc)

sudo wget <http://pjreddie.com/media/files/yolov3-tiny.weights> 로 그 뭔가를 받아주세요.

* 이 파일은 필요한 기능을 다 지원해주는 만큼 너무 커서 git으로 배포를 할 수가 없어요 ㅠㅠ.

![](/files/-MU2zEKgbYMMnVr8ZriX)

일단 roscore를 실행하고, 로봇에서 카메라를 기동해봅시다.

![](/files/-MU2zJir-l0pumGUO_v5)

카메라가 발행하는 토픽은 /main\_camera /image\_raw 입니다.

* 카메라가 정상적으로 토픽을 발행 중인지 확인하는 방법은 rqt\_image\_view를 실행한 다음, 토픽 선택 항목에서 해당 토픽을 선택하고 영상이 뜨면 됩니다.

![](/files/-MU2zP0GauDDHppirgoR)

그 후, launch 파일들이 보관된 곳으로 이동해서

![](/files/-MU2zTw8mpPClDTC4HOY)

nano로 darknet\_ros.launch를 열어주세요.

* sudo로 접근하세요\~

![](/files/-MU2zXzvCbpSIqjozARd)

먼저 아래 그림의 두 군데를 수정하고

![](/files/-MU2zaqwbsbN9Ylqut1h)

아래까지 수정한 다음에 저장해줍니다.

![](/files/-MU2zfgTF_-5jFdEwcx5)

파일을 빠져나가서 nano로 config 폴더의 ros.yaml을 열어주세요.

![](/files/-MU2zkRg7UYDqzOWaCND)

카메라 토픽 부분을 변경해준 다음

* camera --> main\_camera

![](/files/-MU2zoapdToW9_HfIXcV)

드디어 YOLO를 실행해봅니다\~

![](/files/-MU2zslVxWcdCtmkjFZH)

rqt\_image\_view를 열고 아래 토픽 항목을 알맞게 바꾸어주세요.

![](/files/-MUVxa6ikDpk9h5aquVi)

아래는 darknet\_ros를 실행한 화면입니다.

![](/files/-MUVxh0eR74loYAvppQ2)

rqt\_image\_view로 확인해보면 짠 \~

![](/files/-MUVxjdSZyXeMPYqSRrH)

근데, 그림 구경 말고 어떻게 내 코드에서 사용하지? (다음 페이지로)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://omorobot.gitbook.io/manual/product/omo-r1mini/ros/ros1-melodic/yolo1.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
