update
This commit is contained in:
@@ -12,38 +12,51 @@ https://universe.roboflow.com/kemals-workspace-kbc8l/electric-meter-detection-o4
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Install or sync the project dependencies: `uv sync`
|
||||
- The virtual environment is activated.
|
||||
- AWS credentials configured for the profile in `config.yaml`
|
||||
- Infrastructure already deployed with `uv run qc-cli infra setup`
|
||||
- A Roboflow API key exported as `ROBOFLOW_API_KEY`
|
||||
- `curl` and `unzip` available locally
|
||||
|
||||
Install or sync the project dependencies:
|
||||
|
||||
```bash
|
||||
uv sync
|
||||
```
|
||||
|
||||
Set the Roboflow API key for the current shell:
|
||||
|
||||
```bash
|
||||
export ROBOFLOW_API_KEY=your-roboflow-api-key
|
||||
```
|
||||
- Infrastructure already deployed with `qc-cli infra setup`
|
||||
|
||||
## 1. Download The Dataset
|
||||
|
||||
Download version 1 of the dataset in YOLO format. The script uses the Roboflow REST API directly and does not require Python:
|
||||
Register or sign in to Roboflow, then open the dataset page:
|
||||
|
||||
```bash
|
||||
bash examples/meter-detection/download_dataset.sh
|
||||
```text
|
||||
https://universe.roboflow.com/kemals-workspace-kbc8l/electric-meter-detection-o4tfi/dataset/1
|
||||
```
|
||||
|
||||
Confirm the extracted dataset has a YOLO data file and image splits:
|
||||
Download the dataset in YOLOv26 format from the Roboflow UI, then extract the downloaded archive into:
|
||||
|
||||
```text
|
||||
examples/meter-detection/data/electric-meter-detection
|
||||
```
|
||||
|
||||
The `data.yaml` file should be directly under that folder:
|
||||
|
||||
```text
|
||||
examples/meter-detection/data/electric-meter-detection/data.yaml
|
||||
```
|
||||
|
||||
Do not move `data.yaml` into the `train/` split folder.
|
||||
|
||||
After extracting, confirm the dataset has a YOLO data file and image splits:
|
||||
|
||||
```bash
|
||||
find examples/meter-detection/data/electric-meter-detection -maxdepth 2 -type d | sort
|
||||
find examples/meter-detection/data/electric-meter-detection -name data.yaml -print
|
||||
```
|
||||
|
||||
Open `examples/meter-detection/data/electric-meter-detection/data.yaml` and make sure the split paths are relative to that folder:
|
||||
|
||||
```yaml
|
||||
path: .
|
||||
train: train/images
|
||||
val: valid/images
|
||||
test: test/images
|
||||
```
|
||||
|
||||
If your downloaded dataset does not include a `test/` folder, remove the `test:` line.
|
||||
|
||||
The expected layout is similar to:
|
||||
|
||||
```text
|
||||
@@ -54,8 +67,6 @@ examples/meter-detection/data/electric-meter-detection/
|
||||
test/
|
||||
```
|
||||
|
||||
The `test/` split may be absent depending on the exported dataset version.
|
||||
|
||||
## 2. Configure SageMaker Training
|
||||
|
||||
Update `config.yaml` so the training section points at this example's source directory:
|
||||
@@ -107,7 +118,7 @@ sagemaker:
|
||||
Confirm the CLI can see the configured SageMaker role and S3 bucket:
|
||||
|
||||
```bash
|
||||
uv run qc-cli infra status --config config.yaml
|
||||
qc-cli infra status --config config.yaml
|
||||
```
|
||||
|
||||
## 4. Upload The Dataset
|
||||
@@ -115,29 +126,31 @@ uv run qc-cli infra status --config config.yaml
|
||||
Upload the downloaded Roboflow dataset to the `s3.data_prefix` configured in `config.yaml`:
|
||||
|
||||
```bash
|
||||
uv run qc-cli upload examples/meter-detection/data/electric-meter-detection --config config.yaml
|
||||
qc-cli upload examples/meter-detection/data/electric-meter-detection
|
||||
```
|
||||
|
||||
Directory uploads preserve paths relative to the uploaded directory, so SageMaker receives the dataset root with `data.yaml` plus the split directories.
|
||||
|
||||
In SageMaker, this uploaded dataset root is mounted at `/opt/ml/input/data/train`. That `train` path is the SageMaker channel name, not the YOLO `train/` split folder.
|
||||
|
||||
## 5. Start Training
|
||||
|
||||
Submit the SageMaker training job:
|
||||
|
||||
```bash
|
||||
uv run qc-cli train start --config config.yaml
|
||||
qc-cli train start
|
||||
```
|
||||
|
||||
The command prints the submitted SageMaker job name. Check progress with:
|
||||
|
||||
```bash
|
||||
uv run qc-cli train status --config config.yaml
|
||||
qc-cli train status
|
||||
```
|
||||
|
||||
Or pass the job name explicitly:
|
||||
|
||||
```bash
|
||||
uv run qc-cli train status qc-cli-YYYYMMDD-HHMMSS --config config.yaml
|
||||
qc-cli train status qc-cli-YYYYMMDD-HHMMSS
|
||||
```
|
||||
|
||||
## Outputs
|
||||
@@ -167,6 +180,7 @@ Values under `sagemaker.training.hyperparameters` are passed to `source/train.py
|
||||
| `workers` | int | `2` | DataLoader worker count. |
|
||||
| `patience` | int | `20` | Early stopping patience. |
|
||||
| `device` | string | auto | Optional Ultralytics device value such as `0` or `cpu`. |
|
||||
| `data-yaml` | string | auto | Optional path to `data.yaml`; normally discovered from `SM_CHANNEL_TRAIN`. |
|
||||
| `data-yaml` | string | auto | Optional path to `data.yaml`; normally discovered from the uploaded dataset root. |
|
||||
| `dataset-dir` | string | `SM_CHANNEL_TRAIN` | Uploaded dataset root mounted by SageMaker. |
|
||||
|
||||
Do not set `train-dir` or `model-dir` in normal SageMaker runs. SageMaker sets those automatically through `SM_CHANNEL_TRAIN` and `SM_MODEL_DIR`.
|
||||
Do not set `dataset-dir` or `model-dir` in normal SageMaker runs. SageMaker sets those automatically through `SM_CHANNEL_TRAIN` and `SM_MODEL_DIR`.
|
||||
|
||||
Reference in New Issue
Block a user