Skip to content

03. API

dragarcia edited this page May 11, 2020 · 3 revisions

Overview

Our API can be accessed through http://localhost:8000.

Image

[POST] Processing Images

  • Saves the image in the database
  • Runs it against the YOLO model
  • Saves information on the bounding boxes in the database as well.
http://localhost:8000/image/new

Input

Takes in a multipart form including an image file.

Return

[GET] Getting Images

http://localhost:8000/image/get

Return Value

Returns an array of Image objects. If there are any bounding boxes linked to the image, it will be returned as well within the image.

{
    [
        'id': '123',
        'file': 'static/images/123.jpg',
        'height': '300.0',
        'width': '400.0',
        'boxes': [
            'id': 1,
            'x': 0.1,
            'y': 0.2,
            'height': 0.5,
            'width': 0.2,
            'label': 'cat'
            'probability': 0.99
        ]
    ]
}

Filtering

Filters can be applied through query parameters. Valid filters would be any of the following:

  • id
  • file
  • height
  • width

A sample would be:

http://localhost:8000/image/get?id=123

Box

[PUT] Updating Boxes

http://localhost:8000/box/update

Input

Takes in an array of Box objects and updates the boxes linked to the respective image.