DEV Community

Cover image for Image Annotation for AI Model training using Pinata
Suyash Srivastava
Suyash Srivastava

Posted on

Image Annotation for AI Model training using Pinata

This is a submission for the The Pinata Challenge

What I Built

I have built an image annotation application using :

  • FastAPI : Backend
  • Angular: Frontend
  • Pinata : Blob/File Storage

This application would help in doing the annotations of the image dataset. Then these annotations could be exported and be used for AI model training.

Demo

Image description

Image description

My Code

Flow Diagram

Image description

Pinata setup

  • Create an account with Pinata, and fetch the keys.
  • Install and setup .env files
npm i pinata
Enter fullscreen mode Exit fullscreen mode
PINATA_API_KEY=""
PINATA_API_SECRET=""
PINATA_GATEWAY="*.mypinata.cloud"
PINATA_JWT=""
Enter fullscreen mode Exit fullscreen mode
import { PinataSDK } from "pinata";

const pinata = new PinataSDK({
  pinataJwt: "PINATA_JWT",
  pinataGateway: "example-gateway.mypinata.cloud",
});

Enter fullscreen mode Exit fullscreen mode
  • Create methods for Upload & Retrieve Files

Upload File

const file = new File(["hello"], "Testing.txt", { type: "text/plain" });
    const upload = await pinata.upload.file(file);
    console.log(upload);
Enter fullscreen mode Exit fullscreen mode

Retrieve Files

const url = await pinata.gateways.createSignedURL({
        cid: "bafkreib4pqtikzdjlj4zigobmd63lig7u6oxlug24snlr6atjlmlza45dq",
        expires: 1800,
    })
    console.log(url)
Enter fullscreen mode Exit fullscreen mode

Backend & Frontend Code Repo

More Details

Pinata group was created for each project in the application.
Pinata was used for saving the image dataset, with & without annotations. Also the annotation files are saved as JSON on Pinata. Access to the images & Json file is through the signed SDK.

Top comments (0)