Vision
On this page, we’ll dive into the different vision tasks you can use.
These tasks are all powered by the huggingface's transformers.js library. You can use any of the pre-trained ONNX models from the huggingface models or use your own.
Headers
- Name
x-api-group(optional)- Type
- string, default 'main'
- Description
The id of the peer-ai compute group you want to run this compute on.
- Name
x-api-key- Type
- string
- Description
The API key for your PeerAI account.
Image Classification
Image classification is the process of categorizing an image into different classes or categories. It involves training a model on a dataset of labeled images and then using that model to predict the class of new images.
Body
- Name
task- Type
- string
- Description
The task of the pipeline. e.g., 'image-classification', 'object-detection'
- Name
model(optional)- Type
- string, default null
- Description
The name of the pre-trained model to use. If not specified, the default model for the task will be used.
- Name
inputs.0- Type
- string
- Description
The URL or file path of the image to classify.
Request
curl -X POST https://api.peer-ai.com/v1/pipeline \
-H "X-API-Group: {YOUR_COMPUTE_GROUP}" \
-H "X-API-Key: {YOUR_API_KEY}" \
-H "Content-Type: application/json" \
-d "{\"task\": \"image-classification\", \"model\": \"Xenova/vit-base-patch16-224\", \"inputs\": [\"https://files.worldwildlife.org/wwfcmsprod/images/Tiger_resting_Bandhavgarh_National_Park_India/hero_small/6aofsvaglm_Medium_WW226365.jpg\"]}"
Response
[
{
"label": "tiger, Panthera tigris",
"score": 0.905
}
]
Image Segmentation
Image segmentation is the process of dividing an image into multiple segments or regions to simplify the representation of an image into meaningful parts. It is commonly used in computer vision tasks such as object detection and image understanding.
Body
- Name
task- Type
- string
- Description
The task of the pipeline. e.g., 'image-segmentation', 'object-detection'
- Name
model(optional)- Type
- string, default null
- Description
The name of the pre-trained model to use. If not specified, the default model for the task will be used.
- Name
inputs.0- Type
- string
- Description
The URL of the image to perform segmentation on.
Request
curl -X POST https://api.peer-ai.com/v1/pipeline \
-H "X-API-Group: {YOUR_COMPUTE_GROUP}" \
-H "X-API-Key: {YOUR_API_KEY}" \
-H "Content-Type: application/json" \
-d "{\"task\": \"image-segmentation\", \"inputs\": [\"https://huggingface.co/datasets/Xenova/transformers.js-docs/resolve/main/tiger.jpg\"]}"
Response
[
{
"score": 0.965,
"label": "LABEL_198",
"mask": {
"data": {
"0": 255,
"1": 255,
"2": 255,
...
},
"width": 612,
"height": 408,
"channels": 1
}
}
]
Object Detection
Object detection is the task of identifying and localizing objects in an image or video. It involves drawing bounding boxes around objects and assigning labels to them.
Body
- Name
task- Type
- string
- Description
The task of the pipeline. e.g., 'sentiment-analysis', 'text-classification'
- Name
model(optional)- Type
- string, default null
- Description
The name of the pre-trained model to use. If not specified, the default model for the task will be used.
- Name
inputs.0- Type
- string
- Description
The image URL or file path to perform object detection on.
Request
curl -X POST https://api.peer-ai.com/v1/pipeline \
-H "X-API-Group: {YOUR_COMPUTE_GROUP}" \
-H "X-API-Key: {YOUR_API_KEY}" \
-H "Content-Type: application/json" \
-d "{\"task\": \"object-detection\", \"inputs\": [\"https://huggingface.co/datasets/mishig/sample_images/resolve/main/football-match.jpg\"]}"
Response
[
{
"score": 0.999,
"label": "sports ball",
"box": {
"xmin": 95,
"ymin": 446,
"xmax": 181,
"ymax": 514
}
},
{
"score": 0.999,
"label": "person",
"box": {
"xmin": -12,
"ymin": 45,
"xmax": 170,
"ymax": 376
}
},
{
"score": 0.968,
"label": "person",
"box": {
"xmin": 97,
"ymin": 11,
"xmax": 561,
"ymax": 523
}
},
{
"score": 0.934,
"label": "person",
"box": {
"xmin": 532,
"ymin": 28,
"xmax": 648,
"ymax": 325
}
},
{
"score": 0.999,
"label": "person",
"box": {
"xmin": 422,
"ymin": 69,
"xmax": 639,
"ymax": 493
}
}
]
Depth Estimation
Depth estimation is the task of estimating the depth of an image or video. It is commonly used in computer vision tasks such as object detection and image understanding.
Coming Soon
Pose Estimation
Pose estimation is the task of estimating the pose of a person or object in an image or video. It is commonly used in computer vision tasks such as object detection and image understanding.
Coming Soon
Video Classification
Video classification is the task of classifying a video into one of several categories. It is commonly used in computer vision tasks such as object detection and image understanding.
Coming Soon
Face Detection
Face detection is the task of detecting faces in an image or video. It is commonly used in computer vision tasks such as object detection and image understanding.
Coming Soon
Face Recognition
Face recognition is the task of recognizing faces in an image or video. It is commonly used in computer vision tasks such as object detection and image understanding.
Coming Soon
Face Keypoint Detection
Face keypoint detection is the task of detecting facial keypoints in an image or video. It is commonly used in computer vision tasks such as object detection and image understanding.
Coming Soon
Image Similarity
Image similarity is the task of finding similar images in a dataset. It is commonly used in computer vision tasks such as object detection and image understanding.
Coming Soon
Image Search
Image search is the task of finding similar images in a dataset. It is commonly used in computer vision tasks such as object detection and image understanding.
Coming Soon