Creating an Image Labeling Tool: A Step-by-Step Guide

Feb 10, 2024 | Data Science

Welcome to the ultimate guide on setting up an Image Labeling Tool! This web application is designed to assist you in annotating images effortlessly. Whether you need to label images, draw bounding boxes, or segment them into multiple parts, this tool has got you covered. Let’s take a closer look at how to get started!

Why Use This Tool?

The Image Labeling Tool provides a user-friendly interface that allows users to:

  • Draw polygon shapes on images
  • Edit shapes with assisted tracing
  • Collect information through forms with dropdowns and checkboxes
  • Export data in formats compatible with LabelMe

This tool serves as a great alternative to self-hosted solutions like js-segment-annotator or hosted services like LabelBox.

How to Set Up Your Image Labeling Tool

Let’s break down the setup process into manageable chunks:

1. Development Environment Setup

To get started, you’ll want to install node packages for the client, server, and the top-level folder. Follow these commands:

yarn install
cd server
yarn install
cd ..
cd client
yarn install
cd ..

Once your environment is prepared, you can run the server which will perform migrations the first time if the database file doesn’t exist.

env PORT=3000 API_PORT=3001 yarn start

2. Building for Production

When ready to deploy your application, you can build the client app with the following command:

cd client
yarn run build
cd ..

Now, you can run the server app in production mode to serve the client build:

env PORT=80 NODE_ENV=production node serversrcindex.js

3. Configuration Options

You can adjust these environment variables to customize your app:

  • PORT: The port the app is served on (dev or prod)
  • API_PORT: Differentiates the port for the API during development
  • UPLOADS_PATH: Absolute path for uploaded images; defaults to servers folder uploads
  • DATABASE_FILE_PATH: Path for SQLite data storage; defaults to database.sqlite
  • ADMIN_PASSWORD: Set a password for non-labeler actions (in hashed form)

4. Run in Docker

If you prefer to run your image labeling tool in Docker, you can prepare your environment first:

mkdir ~containers
mkdir ~containers/mnt
mkdir ~containers/mnt/db
mkdir ~containers/mnt/uploads

Next, build your Docker container:

docker build -t imslavko/image-labeling-tool .

Then, run it while attaching the necessary mounts:

docker run -p 5000:3000 -u $(id -u):$(id -g) -v ~containers/mnt/uploads:uploads -v ~containers/mnt/db:db -d imslavko/image-labeling-tool

Access the site via localhost:5000.

Troubleshooting Common Issues

Here are some troubleshooting ideas that may help you resolve common challenges:

  • If your server doesn’t start, ensure that your database file paths are correctly defined in your environment settings.
  • In case of issues with the Docker setup, check that you have created the necessary directories and that the Docker daemon is running properly.
  • If you cannot access the application, verify that the port numbers are not blocked or used by other services.

For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.

Conclusion

Setting up an Image Labeling Tool might seem intricate at first, but breaking it down step-by-step simplifies the process dramatically. Once operational, this tool will empower you to annotate images effectively and efficiently.

At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.

Stay Informed with the Newest F(x) Insights and Blogs

Tech News and Blog Highlights, Straight to Your Inbox