zhiqing0205
Add complete U2Net project with HuggingFace preparation
ece7754

πŸš€ Quick Start Guide

One-Command Setup

Method 1: Using our setup script

# Download the setup script
curl -O https://huggingface.co/zhiqing0205/u2net-mvtec-loco-segmentation/raw/main/setup_project.py

# Run setup (downloads everything automatically)
python setup_project.py

# Use the project
cd u2net-mvtec-loco
python mvtec_loco_fg_segmentation.py

Method 2: Using HuggingFace CLI

# Install HuggingFace CLI
pip install huggingface_hub

# Download complete project (equivalent to git clone)
huggingface-cli download zhiqing0205/u2net-mvtec-loco-segmentation \
    --local-dir ./u2net-project --repo-type model

# Use the project
cd u2net-project
python mvtec_loco_fg_segmentation.py

Method 3: Using Python

# One-liner to download everything
python -c "
from huggingface_hub import snapshot_download
snapshot_download('zhiqing0205/u2net-mvtec-loco-segmentation', local_dir='./u2net-project')
print('Done! cd u2net-project && python mvtec_loco_fg_segmentation.py')
"

What Gets Downloaded

βœ… Complete source code
βœ… Pre-trained model weights (u2net.pth - 169MB)
βœ… Documentation (English + Chinese)
βœ… Example scripts and utilities
βœ… Ready to run immediately

File Structure After Download

u2net-mvtec-loco/
β”œβ”€β”€ mvtec_loco_fg_segmentation.py  # Main script
β”œβ”€β”€ saved_models/
β”‚   └── u2net/
β”‚       └── u2net.pth             # Pre-trained model (169MB)
β”œβ”€β”€ model/                         # Model architecture
β”œβ”€β”€ data_loader.py                 # Data utilities
β”œβ”€β”€ README.md                      # English docs
β”œβ”€β”€ README_CN.md                   # Chinese docs
└── ...

Immediate Usage

# Process entire MVTec LOCO dataset
python mvtec_loco_fg_segmentation.py

# Process specific categories
python mvtec_loco_fg_segmentation.py --categories breakfast_box

# Custom threshold
python mvtec_loco_fg_segmentation.py --threshold 0.3

That's it! πŸŽ‰