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.
Try the model live here!
Upload a crochet pattern image (or use a sample) and watch the model identify stitches and estimate yarn usage.
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.
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.
- Box mAP50 0.911 | mAP50-95 0.708
- Mask mAP50 0.903 | mAP50-95 0.614
- Data annotation – Images labeled into 7 stitch categories using Roboflow.
- Data loading – Dataset retrieved directly via the Roboflow API.
- Model training – YOLOv11 trained on the annotated dataset.
- Validation and testing – Model performance evaluated on validation and test sets.
| 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 |
git clone https://github.com/sq7alx/cv-yarn-usage-estimator.git
cd cv-yarn-usage-estimatorpython -m venv venv
Activate the virtual environment macOS / Linux (bash):
source venv/bin/activate
Windows (PS):
venv\Scripts\activate
The application requires a Roboflow API key to access the dataset.
- Sign up or log in to Roboflow
- Navigate to Account Settings → API
- Copy your API key
- Create a
.envfile in the project root:
ROBOFLOW_API_KEY=your_api_key_herepip install -r requirements.txt
Run the app
python run.py
- Implement yarn usage estimation
- Explore hyperparameter tuning to further optimize model performance
- Add local version of the notebook
- Add demo site for interactive showcase