gnurgeldiyev / object-detection-api

A Node.js API for Image Object Detection with Tensorflow.js & COCO SSD pretrained model

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Building an Image Object Detection API with Tensorflow.js & COCO SSD pretrained model

Basic API for posting images and getting the result of detection. Uses COCO SSD pretrained model to detect objects in 300x300 px images. List of object names

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

  • Installed local Node.js environment
  • Package manager to install packages. Yarn or npm

Clone the repo in your environment

git clone https://github.com/gnurgeldiyev/object-detection-api.git

Installing

# move into project folder
cd object-detection-api

# install the dependencies
yarn install

# rename the .env.sample
mv .env.sample .env

# add your variables
nano .env

Running the server

yarn start

Example

# POST - /detection
curl -H "Content-Type: application/octet-stream" --data-binary "@image/bicycle 300x300.jpg" "http://localhost:3000/detection"
Response
{
  "duration": 171,
  "result": [
    {
      "bbox": [
        5.610904097557068,
        85.95118224620819,
        295.6936866044998,
        171.45759165287018
      ],
      "class": "bicycle",
      "score": 0.9325430393218994
    }
  ]
}

Running the tests

yarn test

Built With

License

This project is licensed under the MIT License - see the LICENSE file for details

About

A Node.js API for Image Object Detection with Tensorflow.js & COCO SSD pretrained model

License:MIT License


Languages

Language:JavaScript 100.0%