When embarking on a computer vision project, one of the initial steps involves setting up your models and organizing them into workflows. However, a significant hurdle often arises when it's time to deploy these models efficiently.
Deploying on GPUs can be a real headache. The setup is tricky, and the documentation? Even trickier, especially if you’re dealing with platforms like Google Cloud Platform (GCP). You've got to get a grip on all kinds of GPU configurations, sort out dependencies, and if things go sideways, you’re in for some serious troubleshooting. It can really drain your time and energy.
This is where Ikomia SCALE comes into play. It offers a streamlined platform that greatly simplifies the deployment process for computer vision models, eliminating the need for extensive coding and adaptation across different devices. Whether you're considering a GPU architectures like Google Cloud Platform or other prominent provider, SCALE ensures a smoother transition.
In this blog post, we provide a detailed guide on how to leverage the Ikomia ecosystem to your advantage:
For an in-depth look at what Ikomia SCALE has to offer, feel free to visit the official page [1]. Let's get started and simplify the process of deploying Computer Vision models!
I'm working on developing a face inpainting algorithm tailored for small clothing companies on a tight budget or for my personal projects, like selling clothes on Vinted (this isn't a sponsored ad! 😄).
Below, I'll detail how I used the Ikomia Ecosystem to streamline the process from creating a workflow to deploying the solution.
My algorithm incorporates two models from Hugging Face:
Start by installing the Ikomia Command Line Interface (CLI) in a virtual environment [2]:
The Ikomia CLI allows for seamless interaction with Ikomia SCALE via command line, simplifying project management.
This JSON file will outline the structure of the workflow, including input and output types, along with the parameters used.
We obtain various outputs at different stages of the inpainting algorithm. Initially, we generate a semantic segmentation mask using the Segformer model. We then refine this mask to isolate only the face and hair. This mask is further fine-tuned by cropping around the neck and using dilation to smooth any imprecisions along the mask's edges.
For detailed information on the adjustable parameters that help select the models and optimize the segmentation masks, be sure to visit the HUB model card.
Below are additional results obtained by tweaking the input prompt.
Before deploying, we need to push our workflow on the SCALE.
Begin by either creating an Ikomia account or logging in. You can sign up using your email, Google, or GitHub account.
In Ikomia SCALE, a project acts as a central hub for your workflows, helping you organize them effectively. To create a new project, simply follow these steps:
1. Go to the dashboard and click on the "New Project" button.
2. You'll need to fill out a form with the following information:
To authenticate with Ikomia SCALE, you need to generate an access token. Use the command below, replacing < your_login > and < your_password > with your Ikomia SCALE credentials.
1. Access token management: On the top right corner, find the section for API token management which is located under settings or the account section.
2. Create new token: Click on the option to create a new token. Fill in the required details such as the name of the token and its expiration date.
3. Generate and save the token
4. Copy the token: We are are ready to set the token as an environment variable.
You can then set this token as an environment variable by entering:
This ensures that your token is securely stored and readily accessible for your sessions with Ikomia SCALE.
Once you've set your access token, you're ready to upload your workflow to the Ikomia SCALE platform. Use the following command to push your workflow:
Make sure to replace < project_name > with the actual name of your project on Ikomia SCALE, like ‘Face_inpainting’ for example. This command will upload your workflow JSON file directly to the designated project in SCALE, making it available for management and deployment as required.
Now that your workflow is integrated into your project on Ikomia SCALE, the next step is to deploy it and establish a live endpoint for practical use.
Ikomia SCALE provides three main types of compute infrastructures for deploying your workflows, each designed to meet different computational needs and budget considerations:
Here’s how to deploy your workflow on Ikomia SCALE:
1. Create a Deployment: On the right-hand side of the project interface, you'll find the deployment settings where you can configure and initiate the deployment of your selected workflow.
2. Select the Provider: Choose your preferred cloud provider, like AWS, Google Cloud, or Scaleway, based on their capabilities and your requirements.
3. Choose Deployment Type: Select the type of deployment that fits your needs—serverless for flexible billing on CPU-only environments, CPU instance for dedicated CPU power, or GPU instance for intensive compute tasks.
4. Pick a Region: Choose a geographical region that aligns with your latency needs and data residency requirements. This helps optimize the performance of your application by reducing delay and complying with local data laws.
5. Determine the Size: Based on your computational and memory needs, select the appropriate size for your deployment, ranging from XS (Nvidia L4) to XL (Nvidia A100).
6. Launch Your Deployment: Click the 'Add deployment' button to start the deployment process of your workflow.
Once initiated, the new deployment will appear on the left-hand side of the page under the deployments section. The time it takes for your deployment to become operational can vary, depending on the complexity of the workflow and the specifics of your chosen configuration.
SCALE offers a convenient Test Interface to verify that your deployed workflow is functioning as expected.
Accessing the Test interface: To access the Test Interface, navigate to the page of your deployed workflow and click on the ‘Test me’ button associated with your deployment. You can also access the Test Interface by directly visiting the endpoint’s URL.
Executing your workflow: Here’s how to test your workflow:
Once you've run the workflow, the Test Interface will display the results, allowing you to evaluate the performance and output of your workflow directly.
After successfully deploying your workflow on Ikomia SCALE, you'll receive a REST API endpoint for each deployment. This endpoint is crucial for integrating your computer vision model into your existing applications or systems. It allows your applications to send images to the model and retrieve the processed results seamlessly.
For comprehensive guidance on how to utilize these REST API endpoints effectively, check out our detailed documentation. It provides step-by-step instructions on integration techniques and best practices to ensure smooth and efficient incorporation of your model into your workflow. You can find this valuable resource here. This will help you maximize the functionality and impact of your deployment.
[1] Ikomia SCALE
[2] How to create a virtual environment in Python
[3] Andrea Piacquadio - Woman In Collared Shirt - pexels.com/photo/woman-in-collared-shirt-774909/