
My first goal was to test whether can I make machine vision projects that identify different sizes of these wooden bricks from Woodi. I had four different sizes of bricks.
First I made a bunch of images separately of each brick on a different angle. Then many of them together. I used my two webcams and cell phones. After some testing, I started to add some similar sizes wooden objects to images so the model will separate the bricks from other stuff.
It would be good to use real situation pictures were it would be used. Same kind of camera, lighting and background.
I used trainyolo.com to label all the images. I Collected 770 images and labelled 5188 objects together. And trained 8 models until I was finally satisfied with the results.
My Colab to train the model. Almost the same as the example from trainYOLO.
And my Python code on GitHub
I used Yolo version 8.

Data examples
Sample images from the dataset. Segmented.









Counting different objects on a simulated conveyor line
In this example, it detects all four sizes of brick, tracks them and counts them when they cross the green line.
Recognize only in a predefined region
Detects objects only in the predefined zone (drawn box).

Set Up a Python Virtual Environment
pip install virtualenv
python3 --version
python3.10 -m venv env
source env/bin/activate
pip list
~ deactivate
Save and instal requirements
pip freeze > requirements.txt
~ pip install -r requirements.txt
CUDA error out of memory
nvidia-smi
kill -KILL PID_number
Links
- https://www.youtube.com/watch?v=WgPbbWmnXJ8
- https://www.youtube.com/watch?v=QV85eYOb7gk
- https://ultralytics.com/
- https://app.trainyolo.com/
- https://blog.roboflow.com/yolov8-tracking-and-counting/
- https://colab.research.google.com/github/roboflow-ai/notebooks/blob/main/notebooks/how-to-track-and-count-vehicles-with-yolov8.ipynb?ref=blog.roboflow.com#scrollTo=Q9ppb7bFvWfc