Detect objects in uploaded images
Identify objects in your images using labels
Upload an image to detect objects
Find objects in your images
Upload an image to detect objects
Identify labels in an image with a score threshold
Detect traffic signs in images
Ultralytics YOLO11 Gradio Application for Testing
Upload images to detect objects
State-of-the-art Object Detection YOLOV9 Demo
Detect objects in images
Detect gestures in images and video
Upload an image to detect objects
Transformers.js is a JavaScript library designed for object detection tasks. It allows developers to easily integrate object detection models into web applications, enabling the detection of objects within uploaded images. Built on top of the popular Transformers model architecture, Transformers.js provides a seamless way to leverage pre-trained models for image analysis.
Install the Library
Run the following command to install Transformers.js via npm:
npm install transformers.js
Import the Library
Include Transformers.js in your JavaScript file:
const { Transformers } = require('transformers.js');
Load the Model
Load a pre-trained object detection model:
const model = new Transformers('object-detection');
Detect Objects
Pass an image to the model for object detection:
const results = model.detectObjects(image);
Handle Results
Use the detection results to display bounding boxes or take further action:
results.forEach((result) => {
console.log(`Detected ${result.label} with ${result.score.toFixed(2)} confidence`);
});
What models are supported by Transformers.js?
Transformers.js supports popular object detection models such as YOLO, SSD MobileNet, and Faster R-CNN. These models are pre-trained on large datasets and can be easily loaded for inference.
Can Transformers.js perform real-time object detection?
Yes, Transformers.js is optimized for real-time object detection. However, the performance depends on the model selected and the computational resources available.
How do I handle the detection results?
The detection results are returned as an array of objects, each containing the detected label, score, and bounding box coordinates. You can use these results to display annotations, trigger actions, or store data for further analysis.