Files
2026-09-16 07:28:19 +03:00

59 lines
1.7 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Простой модуль В
## Кадры
```bash
mkdir -p module3/dataset/raw
ffmpeg -i video.mp4 -vf fps=2 module3/dataset/raw/frame_%05d.jpg
```
## Разметка
```bash
label-studio start
```
Откройте `http://localhost:8080`, создайте проект и загрузите кадры через
`Data Import`. В `Labeling Setup` выберите `Computer Vision -> Object Detection
with Bounding Boxes` и создайте классы `hammer`, `pliers`, `wrench`.
После разметки выберите `Export -> YOLO` и распакуйте архив так, чтобы получилось:
```text
module3/dataset/label-studio/
├── classes.txt
├── images/
└── labels/
```
Затем:
```bash
python3 module3/simple_prepare_dataset.py
```
## Обучение
```bash
cd module3
source .venv/bin/activate
yolo detect train model=yolo11n.pt data=training_new/data.yaml epochs=30 patience=7 imgsz=512 batch=8 device=0 project=training_new/runs name=tools exist_ok=True
cp training_new/runs/tools/weights/best.pt models/latest.pt
```
## Запуск
```bash
source /opt/ros/jazzy/setup.bash
source ~/ros2_ws/install/setup.bash
cd ~/scripts/mvch
module3/.venv/bin/python module3/simple_module_b.py
```
Сначала открывается живое окно YOLO. Затем в терминале появляется пустой выбор
предмета. После Enter захват закрывается, а через 2 секунды открывается. Выход —
`Q` или `Esc`.
Камера реального RMC1: `/RMC1/arm95/svcam/right/image`. Для проверки в Webots
замените константу `CAMERA` на `/RMC1/arm95/camera_gripper/image_color`.