Hands-on Machine Learning / Computer Vision notebook, built to train a YOLO26 model from scratch and observe, in practice, the core concepts of neural network training: dataset splitting, epochs, learning rate, the ADAM optimizer, overfitting vs. underfitting, early stopping, and the Precision / Recall / F1-Score metrics.
Presented as Activity 2 at the Congresso Acadêmico Unifesp 2026, in a class on Artificial Intelligence and Computer Vision alongside the Black Bee Drones team.
- How to load a dataset in YOLO format (via Roboflow)
- Splitting a dataset into train / validation / test (70/20/10) and why it matters
- Training a YOLO26 model with every parameter explained (
epochs,patience,lr0,optimizer) - Visualizing training batches (what the network is actually "seeing")
- Reading the Learning Curve to spot overfitting and underfitting
- Computing Precision, Recall, F1-Score, and reading the confusion matrix
- Practical diagnosis: how to tell whether the problem is the model or the dataset, and how to fix it by retraining (with side-by-side result comparison)
- Visual identification of detections, drawn manually with OpenCV
Malignant and Benign
(breast ultrasound, ~2,150 images, classes benign/malignant) — via Roboflow Universe.
Any other dataset in YOLO format also works.
- Open the notebook in Google Colab (button above) or locally with Jupyter.
- Run the cells in order, top to bottom.
- In Section 2, when prompted, paste your private Roboflow API key
(app.roboflow.com/settings/api). The key is
requested at runtime (
getpass) and is never saved in the notebook — you can run and commit it without risk of leaking a credential. - Recommended: enable GPU (
Runtime > Change runtime type > GPU, if using Colab).
pip install -r requirements.txt
jupyter notebook Activity_2_Machine_Learning.ipynb- No credentials are stored in the notebook — the Roboflow API key is requested via
getpasson every run. .gitignorealready excludes training result folders (runs_activity/), model weights (.pt), and downloaded datasets, which shouldn't be pushed to the repository since they're heavy and specific to each run.- Before committing, double-check that no cell has saved output containing sensitive
data (
Cell > All Output > Clearin Jupyter, orEdit > Clear all outputsin Colab).
Feel free to use this material for educational purposes, with attribution. This license applies to the code and content of this repository only, not to the dataset, which has its own license on Roboflow Universe.