BaseURL:
https://ml.api.utagoe.com/yolo
Pack dataset in following directory structure.
(dataset_name)
│
├── property.json
└── data
├── IMG_20190709_153520.jpg
├── IMG_20190709_153520.txt
├── IMG_20190709_153537.jpg
├── IMG_20190709_153537.txt
├── IMG_20190709_153542.jpg
├── IMG_20190709_153542.txt
└── ...
You should prepare property.json, that have information of class label.
Example:
{
"class_num":2,
"classes":["car", "truck"],
"use_tiny":false
}
Put image files and text label files in 'data' dir.
Image and text must have same filename.
Each image file must be (png or jpg or jpeg).
You should prepare text label files that have information of class label and coordinate data.
One text file include labels of one image.
Example:
0 0.371349 0.396660 0.178025 0.505219
1 0.459872 0.238579 0.234875 0.349085
In each row,
Each coordinate is in range of 0 ~ 1. this value is ratio to image size.
For example above, if picture is 100x100 px , 1st row means "its center position is (37, 39). its size is (17, 50)."
URL: POST /train
yolo/train create new model and new training process.
Response is url of yolo/progress.
| Key | Value |
|---|---|
| Content-type | application/json |
| Name | Type | Required | In | Description |
|---|---|---|---|---|
| access_key | text | Yes | Body | your access key |
| model_name | text | Yes | Body | name of model |
| dataset | text | Yes | Body | specified dataset ID |
| batch_size | int | No (default=1) | Body | batch_size |
| subdivisions | int | No (default=1) | Body | subdivisions |
| lr | float | No (default=0.001) | Body | learning rate |
| final_epoch | int | No 1 | Body | final epoch number |
| source | text | No (default=None) | Body | source model name |
curl https://ml.api.utagoe.com/yolo/train -F access_key=ExampleAccessKey1234 -F model_name=exapmle_model -F dataset=example_data -F batch_size=100 -F lr=0.001 -F source=model_0
Status: 200 OK
{
"url": "http://localhost:8000/yolo/progress?model_name=example_model"
}
URL: POST /stop
yolo/stop kill training process of model.
This function is not stopping but killing. When you restart, training will start from last checkpoint.
| Key | Value |
|---|---|
| Content-type | application/json |
| Name | Type | Required | In | Description |
|---|---|---|---|---|
| access_key | text | Yes | Body | your access key |
| model_name | text | Yes | Body | model to stop |
curl https://ml.api.utagoe.com/yolo/stop -F access_key=ExampleAccessKey1234 -F model_name=exapmle_model
Status: 200 OK
URL: POST /restart
yolo/restart literally restart training process of existing stopped model.
When you restart, training will start from last checkpoint.
| Key | Value |
|---|---|
| Content-type | application/json |
| Name | Type | Required | In | Description |
|---|---|---|---|---|
| access_key | text | Yes | Body | your access key |
| model_name | text | Yes | Body | model to restart |
curl https://ml.api.utagoe.com/yolo/restart -F access_key=ExampleAccessKey1234 -F model_name=exapmle_model
Status: 200 OK
{
"url": "http://localhost:8000/yolo/progress?model_name=example_model"
}
URL: GET /progress
yolo/progress retrieve training progress.
| Key | Value |
|---|---|
| Access-Key | YourAccessKey |
| Name | Type | Required | In | Description |
|---|---|---|---|---|
| model_name | text | Yes | Query | model to get progress |
curl https://ml.api.utagoe.com/yolo/progress --access_key ExampleAccessKey1234 --model_name exapmle_model
Status: 200 OK
{
"model_name": "example_model",
"dataset": "example_data",
"current_steps": 12000,
"max_steps": 50000,
"iou": 0.46587
}
URL: POST /predict
yolo/predict run predict process.
When you predict, last checkpoint of the model is used.
This API returns URL including key for retrieve result data.
| Key | Value |
|---|---|
| Content-type | application/json |
| Name | Type | Required | In | Description |
|---|---|---|---|---|
| access_key | text | Yes | Body | your access key |
| model_name | text | Yes | Body | model to be used |
| dataset_id | text | Yes2 | Body | dataset id to be processed |
curl https://ml.api.utagoe.com/yolo/predict -F access_key=ExampleAccessKey1234 -F model_name=exapmle_model -F dataset_id=example_data
Status: 200 OK
{
"url": "http://localhost:8000/yolo/output?key=20201216173126"
}
URL: GET /output
yolo/output retrieve result of yolo/predict.
| Key | Value |
|---|---|
| Access-Key | YourAccessKey |
| Name | Type | Required | In | Description |
|---|---|---|---|---|
| key | text | Yes | Query | key specific to predict process |
curl https://ml.api.utagoe.com/yolo/output --key 20201216173126
Status: 200 OK
{
"done": true,
"results": [
{
"image": "acbde.jpg",
"boxes": [
{
"class": "vehicle",
"score"" 0.68,
"x": 0.51,
"y": 0.35,
"w": 0.23,
"h": 0.12
}
]
}
]
}
URL: GET /list
yolo/list retrieve list of existing models.
| Key | Value |
|---|---|
| Access-Key | YourAccessKey |
| Name | Type | Required | In | Description |
|---|---|---|---|---|
curl https://ml.api.utagoe.com/yolo/list --access_key ExampleAccessKey1234
Status: 200 OK
{
"done": true,
"results": [
{
"image": "acbde.jpg",
"boxes": [
{
"class": "vehicle",
"score"" 0.68,
"x": 0.51,
"y": 0.35,
"w": 0.23,
"h": 0.12
}
]
}
]
}
URL: POST /delete
yolo/delete deletes spcefied model.
| Key | Value |
|---|---|
| Content-type | application/json |
| Name | Type | Required | In | Description |
|---|---|---|---|---|
| access_key | text | Yes | Body | your access key |
| model_name | text | Yes | Body | model to delete |
curl https://ml.api.utagoe.com/yolo/delete -F access_key=ExampleAccessKey1234 -F model_name=exapmle_model
Status: 200 OK
URL: GET /validate
yolo/validate checks specified dataset whether its format is valid for training yolov2.
| Key | Value |
|---|---|
| Access-Key | YourAccessKey |
| Name | Type | Required | In | Description |
|---|---|---|---|---|
| dataset | text | Yes | Query | dataset to validate |
curl https://ml.api.utagoe.com/yolo/validate?dataset=example_dataset --access_key ExampleAccessKey1234
Status: 200 OK
{
"valid": false,
"message":"......"
}
URL: GET /download
yolo/download provide download link of zipped model weights.
| Key | Value |
|---|---|
| Access-Key | YourAccessKey |
| Name | Type | Required | In | Description |
|---|---|---|---|---|
| model_name | text | Yes | Body | model to download |
curl https://ml.api.utagoe.com/yolo/download --access_key ExampleAccessKey1234 --model_name exapmle_model
Status: 200 OK
(file download)_
DATASET_ROOT, MODEL_ROOT, and PREDICTION_ROOT are variable of path.
tree below is actual akiba's environment now.
utagoe_ml_api/yolo
│
├── admin.py
├── apps.py
├── darknet/
├── darknet_database
│ ├── datasets
│ │ └── test_bottle
│ │ ├── data
│ │ │ ├── IMG_20190709_153520.jpg
│ │ │ ├── IMG_20190709_153520.txt
│ │ │ ├── ...
│ │ │ └── ...
│ │ └── property.json # this includes class names and other properties depend on dataset
│ └── models
│ └── test_bottle
│ ├── backup/
│ ├── test_bottle.cfg
│ ├── test_bottle.data
│ ├── test_bottle.names
│ ├── test_bottle.train.list
│ └── test_bottle.valid.list
├── darknet_prediction
│ ├── 1673578468.json
│ ├── ...
│ └── ...
├── migrations/
├── models.py
├── tests.py
├── urls.py
└── views.py