This project contains scripts to upload your Face Mask Detection dataset to Roboflow.
dataset/
├── train/
│ ├── WithMask/
│ └── WithoutMask/
├── val/
│ ├── WithMask/
│ └── WithoutMask/
└── test/
├── WithMask/
└── WithoutMask/
pip install -r requirements.txtOr manually:
pip install roboflow python-dotenvThe .env file is already set up with your credentials:
ROBOFLOW_API_KEY=ZiTfwXqKSN7clsBdZl73
ROBOFLOW_WORKSPACE_ID=project0-ju8av
ROBOFLOW_PROJECT_ID=mask-detection-h1gxk
DATASET_PATH=./dataset.env file to version control! (It's already in .gitignore)
python upload_to_roboflow.pyOr:
./upload_to_roboflow.py- ✅ Loads configuration from
.envfile - ✅ Validates Roboflow package installation
- ✅ Verifies dataset structure and counts images
- ✅ Creates
data.yamlfile for Roboflow - ✅ Authenticates using your API key
- ✅ Uploads all images with proper split tags (train/val/test)
- ✅ Shows upload progress and summary
- Automatic Authentication: Uses API key from
.env(no browser login needed) - Progress Tracking: Shows upload progress for each split
- Error Handling: Continues even if individual images fail
- Class Tagging: Automatically tags images with their class labels
- Split Management: Properly organizes images into train/val/test splits
Your .env file contains two types of API keys:
- Private API Key:
ZiTfwXqKSN7clsBdZl73(used for uploads and platform APIs) - Publishable API Key:
rf_aqlZnGhlSTODrFULwBeyUg0pllF3(for client-side inference)
The upload script uses the Private API Key for authentication.
.env- Environment variables (API keys and configuration).gitignore- Prevents sensitive files from being committedrequirements.txt- Python dependenciesdataset/data.yaml- Dataset metadata (created during upload)
- The
.envfile contains sensitive API keys - It's already added to
.gitignoreto prevent accidental commits - Never share your API keys publicly
pip install roboflow python-dotenv- Check that your API key in
.envis correct - Verify you have access to the workspace and project
- Ensure your internet connection is stable
- Check that image files are valid (PNG, JPG, JPEG)
- Verify dataset structure matches the expected format