cv (yolov5)

program that can find patterns or make decisions from a previously unseen dataset.

Note: Drone Computer Vision Repo w/ Datasets

1 - Video/Roboflow: Gather images for dataset

LogoDescription

We can film a video of the item we want to detect and then upload to Roboflow. On the Roboflow website, we can extract frames every X seconds to create a .jpg file each interval. Then we can begin labeling each image on Roboflow.

Roboflow is a website where you upload images, label them, and export a zip file (images & .xml files).

Useful to share dataset and have 3 people label at the same time

1.1 - Unlabeled Images to Labeled Images

UnlabledLabeled (Desired Outcome)

2 - Colab: Train Custom Model

LogoDescription

-The following website uses Python

-here we set up libraries

- collections of pre-written code that you

can use to perform specific tasks

-Prepare the dataset

-Train the model

-Evaluate the model performance with validation data

-Export the model as .tflite file

Open up Google Colab for Yolov5 Training

Follow this video for more details

#made changes to /yolov5train/yolov5/dataset.yaml 
train: ../data/images/train/
val: ../data/images/valid/

# number of classes
nc: 1

# class names
names: ['Target']

3 - Export Model

#############################
#                           #
##         RESULTS         ##
#                           #
#############################

# 'download /yolov5/runs/train/exp/weights/best.pt'

Download the best.pt file to upload to Raspberry Pi.

Have a naming convention like '3-27-2024--300epochs-' Demo here

4 - Set up Pi - Installation

Python Library Versions located here

Ctrl + Alt + T

NOTE: (2:54)

-click top left

-preferences

-raspberry pi configuration

-tabs: interfaces

-enable camera

-reboot

5 - Run on Pi

Ctrl + Alt + T

(Note: if on virtual machine for testing): Devices > Webcams > Check Integrated cam box

Download your best.pt file after training, you can use Github or Google Drive

cd yolov5

cp ~/Downloads/best.pt .

gedit detect.py

  • (Note: make sure you use correct naming convention)

  • got to line 53 and type:

    • weights = 'best.pt',

  • go and comment line 54:

    • weights = 'yolov5s.pt',

sudo python3 detect.py

sudo python3 detect.py --weights 3-27-13-best.pt --source 0 or sudo python3 detect.py --weights best.pt --source 0

Last updated