Skip to content

sq7alx/cv-yarn-usage-estimator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Yarn Usage Estimator

Python Ultralytics YOLOv11 PyTorch Roboflow Flask

Model preview

Computer vision with YOLOv11 for detecting crochet stitches and estimating yarn usage.

The trained model can be tested via a Flask web app or your own images.

Repo includes a Colab notebook demonstrating dataset preparation, model training, and evaluation.

Demo

Try the model live here!

Upload a crochet pattern image (or use a sample) and watch the model identify stitches and estimate yarn usage.

Use Case

This tool helps crochet enthusiasts estimate the amount of yarn needed for their projects by analyzing images of patterns.

It automatically detects different stitch types and calculates a yarn usage estimate with margin for thickness.

obraz

yolov11-crochet-stitch-seg-colab.ipynb

The notebook demonstrates the segmentation of crochet stitches on graphic patterns using YOLOv11.
It provides a complete end-to-end workflow from dataset preparation to model training and evaluation.

Key Metrics

  • Box mAP50 0.911 | mAP50-95 0.708
  • Mask mAP50 0.903 | mAP50-95 0.614

Workflow

  1. Data annotation – Images labeled into 7 stitch categories using Roboflow.
  2. Data loading – Dataset retrieved directly via the Roboflow API.
  3. Model training – YOLOv11 trained on the annotated dataset.
  4. Validation and testing – Model performance evaluated on validation and test sets.

Tech Stack

Component Technology
Model YOLOv11 (Ultralytics)
Data Roboflow – self-annotated (7 stitch classes)
Backend Flask
Frontend Custom HTML/JS/CSS (served via Flask)
Language Python 3.10+
Deployment Render

Run Locally

Clone the repository

git clone https://github.com/sq7alx/cv-yarn-usage-estimator.git
cd cv-yarn-usage-estimator

Create virtual environment

python -m venv venv

Activate the virtual environment macOS / Linux (bash):

source venv/bin/activate

Windows (PS):

venv\Scripts\activate

Configure Roboflow API

The application requires a Roboflow API key to access the dataset.

  1. Sign up or log in to Roboflow
  2. Navigate to Account Settings → API
  3. Copy your API key
  4. Create a .env file in the project root:
ROBOFLOW_API_KEY=your_api_key_here
pip install -r requirements.txt

Run the app

python run.py

TODO

  • Implement yarn usage estimation
  • Explore hyperparameter tuning to further optimize model performance
  • Add local version of the notebook
  • Add demo site for interactive showcase

About

Computer vision with YOLOv11 for detecting crochet stitches and estimating yarn usage.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors