This project imports annotation data from a JSON file into a PostgreSQL database using Prisma. It also includes the conversion of rectangle coordinates to YOLO format.
- Node.js
- Yarn
- Docker
- Docker Compose
git clone <repository-url>
cd <repository-directory>
Rename the .env.example
file to .env
and update the environment variables as needed.
mv .env.example .env
Ensure Docker and Docker Compose are installed on your system. Then, run the following command to start PostgreSQL:
docker-compose up -d
Install the required dependencies using Yarn:
yarn install
Run the import script to populate the database with annotation data from the JSON file:
yarn start:dev
To view and manage the database, open Prisma Studio:
yarn prisma studio
The import script includes a function to convert rectangle coordinates to YOLO format. The conversion function takes x
, y
, width
, height
, imageWidth
, and imageHeight
as inputs and returns the YOLO formatted coordinates.
- .env: Environment variables
- docker-compose.yml: Docker Compose configuration for PostgreSQL
- prisma/schema.prisma: Prisma schema definition
- src/main.ts: Main script to import data and convert coordinates to YOLO format
- src/utils/convertToYolo.ts: Utility function for YOLO format conversion