This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
projects:farmrobot:step-by-step-example [2021/02/27 15:48] jason |
projects:farmrobot:step-by-step-example [2021/04/01 02:25] (current) |
||
|---|---|---|---|
| Line 17: | Line 17: | ||
| * Display (over HDMI or DisplayPort) | * Display (over HDMI or DisplayPort) | ||
| * USB keyboard | * USB keyboard | ||
| - | * CSI or USB camera | + | * CSI or USB camera |
| * Configured Arduino | * Configured Arduino | ||
| Line 46: | Line 46: | ||
| You should be able to see a '' | You should be able to see a '' | ||
| - | The [[https:// | + | The [[https:// |
| In this example we assume that we have connected a [[https:// | In this example we assume that we have connected a [[https:// | ||
| Line 59: | Line 59: | ||
| <WRAP info> | <WRAP info> | ||
| - | Consult the repository' | + | Consult the repository' |
| </ | </ | ||
| + | |||
| + | Furthermore, | ||
| + | |||
| + | The '' | ||
| + | |||
| + | <file shell> | ||
| + | sudo apt install -y v4l-utils | ||
| + | </ | ||
| + | |||
| + | If the installation was successful, you can go ahead and use it: | ||
| + | |||
| + | <file shell> | ||
| + | v4l2-ctl -d /dev/video0 --list-formats-ext | ||
| + | </ | ||
| + | |||
| + | For the camera used in this example ([[https:// | ||
| + | |||
| + | < | ||
| + | ioctl: VIDIOC_ENUM_FMT | ||
| + | Index : 0 | ||
| + | Type : Video Capture | ||
| + | Pixel Format: ' | ||
| + | Name : Motion-JPEG | ||
| + | Size: Discrete 1600x1200 | ||
| + | Interval: Discrete 0.067s (15.000 fps) | ||
| + | Size: Discrete 3264x2448 | ||
| + | Interval: Discrete 0.067s (15.000 fps) | ||
| + | Size: Discrete 2592x1944 | ||
| + | Interval: Discrete 0.067s (15.000 fps) | ||
| + | Size: Discrete 2048x1536 | ||
| + | Interval: Discrete 0.067s (15.000 fps) | ||
| + | Size: Discrete 1280x960 | ||
| + | Interval: Discrete 0.067s (15.000 fps) | ||
| + | Size: Discrete 1024x768 | ||
| + | Interval: Discrete 0.067s (30.000 fps) | ||
| + | Size: Discrete 800x600 | ||
| + | Interval: Discrete 0.067s (30.000 fps) | ||
| + | Size: Discrete 640x480 | ||
| + | Interval: Discrete 0.067s (30.000 fps) | ||
| + | Size: Discrete 329x240 | ||
| + | Interval: Discrete 0.067s (30.000 fps) | ||
| + | Size: Discrete 1600x1200 | ||
| + | Interval: Discrete 0.067s (15.000 fps) | ||
| + | |||
| + | Index : 1 | ||
| + | Type : Video Capture | ||
| + | Pixel Format: ' | ||
| + | Name : YUYV 4:2:2 | ||
| + | Size: Discrete 1600x1200 | ||
| + | Interval: Discrete 0.100s (10.000 fps) | ||
| + | Size: Discrete 3264x2448 | ||
| + | Interval: Discrete 0.067s (2.000 fps) | ||
| + | Size: Discrete 2592x1944 | ||
| + | Interval: Discrete 0.333s (3.000 fps) | ||
| + | Size: Discrete 2048x1536 | ||
| + | Interval: Discrete 0.333s (3.000 fps) | ||
| + | Size: Discrete 1280x960 | ||
| + | Interval: Discrete 0.100s (10.000 fps) | ||
| + | Size: Discrete 1024x768 | ||
| + | Interval: Discrete 0.100s (10.000 fps) | ||
| + | Size: Discrete 800x600 | ||
| + | Interval: Discrete 0.067s (30.000 fps) | ||
| + | Size: Discrete 640x480 | ||
| + | Interval: Discrete 0.067s (30.000 fps) | ||
| + | Size: Discrete 329x240 | ||
| + | Interval: Discrete 0.067s (30.000 fps) | ||
| + | Size: Discrete 1600x1200 | ||
| + | Interval: Discrete 0.100s (10.000 fps) | ||
| + | </ | ||
| ==== - Checking configured Arduino ==== | ==== - Checking configured Arduino ==== | ||
| Line 73: | Line 142: | ||
| ===== - Setting up our custom implementation of YOLOv5 ===== | ===== - Setting up our custom implementation of YOLOv5 ===== | ||
| + | |||
| + | ==== - Cloning the repositories ==== | ||
| + | |||
| + | First, clone the [[https:// | ||
| + | |||
| + | <file shell> | ||
| + | git clone https:// | ||
| + | </ | ||
| + | |||
| + | Then, change into the repository' | ||
| + | |||
| + | <file shell> | ||
| + | cd farm-robot-yolov5 | ||
| + | |||
| + | git clone https:// | ||
| + | </ | ||
| + | |||
| + | Once this is set up, you are theoretically ready to build the [[https:// | ||
| + | |||
| + | ==== - Configuration ==== | ||
| + | |||
| + | The repository comes with a '' | ||
| + | |||
| + | <file shell> | ||
| + | cp default_config.toml config.toml | ||
| + | </ | ||
| + | |||
| + | The '' | ||
| + | |||
| + | In the newly created '' | ||
| + | |||
| + | <file shell> | ||
| + | v4l2src device=/ | ||
| + | </ | ||
| + | |||
| + | <WRAP important> | ||
| + | It is important to replace the '' | ||
| + | </ | ||
| + | |||
| + | The configured '' | ||
| + | |||
| + | <file toml> | ||
| + | [yolov5] | ||
| + | # Input source. | ||
| + | source = " | ||
| + | |||
| + | ... | ||
| + | </ | ||
| + | |||
| + | <WRAP info> | ||
| + | Consult the repository' | ||
| + | </ | ||
| + | |||
| + | <WRAP important> | ||
| + | If you intend to run the [[https:// | ||
| + | </ | ||
| + | |||
| + | ==== - Building the Docker image ==== | ||
| + | |||
| + | Building the [[https:// | ||
| + | |||
| + | <file shell> | ||
| + | sudo docker build -t farm-robot-yolov5 . | ||
| + | </ | ||
| + | |||
| + | <WRAP important> | ||
| + | The build process of the [[https:// | ||
| + | </ | ||
| + | |||
| + | ==== - Instantiating the Docker container ==== | ||
| + | |||
| + | When instantiating the [[https:// | ||
| + | |||
| + | <file shell> | ||
| + | sudo docker run -it --rm --runtime nvidia --device /dev/video0 --device / | ||
| + | </ | ||
| + | |||
| + | <WRAP info> | ||
| + | Consult the repository' | ||
| + | </ | ||
| + | |||
| + | ==== - Starting the inference ==== | ||
| + | |||
| + | Once the interactive [[https:// | ||
| + | |||
| + | <file shell> | ||
| + | python3 . | ||
| + | </ | ||
| + | |||
| + | If everything is configured correctly, the delta arm should start to move to its home position and then to its configured initial position. A few seconds after that, [[https:// | ||
| + | |||