Fashion

FREEMIUM
Verified
By API 4 AI | Updated 4 months ago | Visual Recognition
Popularity

9.3 / 10

Latency

1,126ms

Service Level

100%

Followers: 2
Resources:
Product Website
API Creator:
avatar
API 4 AI
api4ai
Rate API:
Log In to Rate API

README

Fashion

This Fashion API analyzes a picture and gives a list of possible clothes and accessories that could be present on that picture along with their probabilities.

Its algorithm is trained on the most common types of apparel and is suitable for various fashion-related applications as well as other goals for visual recognition.

This API is created by API4AI. We build our APIs on a completely cloud technology stack which provides full operability, scalability and stable uptime. Our sole goal is to create out-of-the-box self-contained AI solutions that can easily be integrated into any application with just a few simple steps.

Demo

Try our service via:
🤖 Telegram demo bot: https://t.me/a4a_fashion_bot
🔗 Web demo: https://api4.ai/apis/fashion

Contacts

Feel free to contact API4AI team if have any questions.
📩 Email: hello@api4.ai
💬 Telegram: https://t.me/a4a_support_bot
🔗 Instagram: https://www.instagram.com/api4ai
🔗 Twitter: https://twitter.com/api4ai
🔗 Facebook: https://www.facebook.com/api4ai.solutions

Overview

Service for fashion image classification.

The service classifies input image and responds with fashion classes and their probabilities.

Endpoints

METHOD URL DESCRIPTION
GET /fashion/v1/version Get service version.
POST /fashion/v1/results Perform image analysis and get results.

Get version

Returns an actual version of the service in format vX.Y.Z where X is the version of API.

PROPERTY DESCRIPTION
Endpoint /fashion/v1/version
Method GET
Query parameters
POST parameters

Examples

Request:

$ curl -X 'GET' 'https://fashion4.p.rapidapi.com/v1/version'

Response:

v1.5.0

Analyse image and return results

Performs actual image analysis and responds with results.

PROPERTY DESCRIPTION
Endpoint /fashion/v1/results
Method POST
Query parameters -
POST parameters image, url

Response schema

For responses with 200 HTTP code the type of response is JSON object with the following schema:

{
  "results": [
    {
      "status": {
        "code": ...,
        "message": ...
      },
      "name": ...,
      "md5": ...,
      "entities": [
        {
          "kind": "classes",
          "name": "fashion-classes",
          "classes": {
            ...
          }
        }
      ]
    }
  ]
}

Primary fields:

Name Type Description
results[].status.code string Status code of image processing: ok or failure.
results[].status.message string Human readable explanation for status of image processing.
results[].name string Original image name passed in request (e.g. my_image.jpg).
results[].md5 string MD5 sum of original image passed in request.
results[].entities[].classes object Predicted classes and probabilities.

Other fields that are not described above always have the same values.

Probabilities are float values in range from 0.0 to 1.0.

Passing image

Image can be passed by posting regular “multipart form data” in two alternative ways:

  • as binary file in image field
  • as URL to some public resource in url field

Image must be a regular JPEG or PNG image (with or without transparency).
Usually such images have extensions: .jpg, .jpeg, .png.
The service checks input file by MIME type and accepts the following types:

  • image/jpeg
  • image/png

The size of image file must be less than 16Mb.

Examples

Request:

curl -X 'POST' 'https://fashion4.p.rapidapi.com/v1/results' -F 'image=@image.jpg'

Response:

{
  "results": [
    {
      "status": {
        "code": "ok",
        "message": "Success"
      },
      "name": "image.jpg",
      "md5": "6ea449c4645b8811eef1342040725687",
      "entities": [
        {
          "kind": "classes",
          "name": "fashion-classes",
          "classes": {
            "top, t-shirt, sweatshirt": 0.04409244656562805,
            "outwear": 0.008208364248275757,
            "vest": 0.3351793885231018,
            "shorts": 0.009493917226791382
          }
        }
      ]
    }
  ]
}

Possible errors

The service can not process an image

When client sends an image that can not be processed for some reason(s), the service responds with 200 code and returns JSON object in the same format as the format for successful analysis. In this case, the results[].status.code will have failure value and results[].status.message will contain relevant explanation.

Example of possible reasons for the issue:

  • Unsupported file MIME type
  • Corrupted image
  • File passed as URL is too big or non downloadable

Example response for corrupted image:

{
  "results": [
    {
      "status": {
        "code": "failure",
        "message": "Can not load image."
      },
      "name": "file.jpg",
      "md5": "d41d8cd98f00b204e9800998ecf8427e",
      "entities": []
    }
  ]
}

Request size is too big

Request size is limited by approximately 32Mb.
When client sends request that exceeds this limit, the service responds with 413 code.

The typical reason for exceeding this limit is overly large image.
Taking into account additional HTTP overhead, we strongly recommend to not pass image files of size more than 16Mb.

Example response for too big request:

Error: Request Entity Too Large

Your client issued a request that was too large.

Missing image or url

When client sends a request without an image and url, the service responds with 422 code and returns JSON object.

Example response for request without image or url:

{"detail": "Missing image or url field."}
Rating: 5 - Votes: 1